mirror of
https://github.com/nmap/nmap.git
synced 2026-01-18 12:19:02 +00:00
Fix a memory leak in l_nsock_get_info when trying to get information
from a closed socket.
This commit is contained in:
@@ -856,10 +856,6 @@ static int l_nsock_get_info(lua_State * L)
|
||||
|
||||
struct sockaddr remote;
|
||||
|
||||
char *ipstring_local = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
|
||||
|
||||
char *ipstring_remote = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
|
||||
|
||||
if (udata->nsiod == NULL)
|
||||
{
|
||||
lua_pushboolean(L, false);
|
||||
@@ -872,6 +868,9 @@ static int l_nsock_get_info(lua_State * L)
|
||||
|
||||
lua_pushboolean(L, true);
|
||||
|
||||
char *ipstring_local = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
|
||||
char *ipstring_remote = (char *) safe_malloc(sizeof(char) * INET6_ADDRSTRLEN);
|
||||
|
||||
lua_pushstring(L, inet_ntop_both(af, &local, ipstring_local));
|
||||
lua_pushnumber(L, inet_port_both(af, &local));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user