Fix a memory leak in l_nsock_get_info when trying to get information

from a closed socket.
This commit is contained in:
david 2009-08-24 21:09:47 +00:00
parent cfeb9d6563
commit ddf05afe1b

View file

@ -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));