mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Add a missing freeaddrinfo() in Unix sk_newlistener.
If we use getaddrinfo to translate the source IP address into a sockaddr, then we need to freeaddrinfo the returned data later. Patch due to Tim Kosse.
This commit is contained in:
parent
dd0f1e5cc7
commit
fe24f4dfba
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user