mirror of
https://github.com/nmap/nmap.git
synced 2026-06-27 03:33:07 +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:
parent
cfeb9d6563
commit
ddf05afe1b
1 changed files with 3 additions and 4 deletions
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue