X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fuxnet.c;h=235d6fd97d039d3ed2f97167e68e4285935981ee;hb=f004bcca17a789356c32527a396b68b71a773db2;hp=c3002e4388ebc8bd50d58da45db53fbd599bf412;hpb=0f04cab1517cd158e2d959bf0879ae5983d163fd;p=PuTTY.git diff --git a/unix/uxnet.c b/unix/uxnet.c index c3002e43..235d6fd9 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -780,7 +780,7 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i { int s; #ifndef NO_IPV6 - struct addrinfo hints, *ai; + struct addrinfo hints, *ai = NULL; char portstr[6]; #endif union sockaddr_union u; @@ -926,6 +926,12 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i } retcode = bind(s, &addr->sa, addrlen); + +#ifndef NO_IPV6 + if (ai) + freeaddrinfo(ai); +#endif + if (retcode < 0) { close(s); ret->error = strerror(errno);