diff --git a/Changelog b/Changelog index b39e4ce..59d2129 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Fix leak and potential crash in lame_resolv() using IPv6. (caf, snadge) + * Apply patch from snadge defining BIND_4_COMPAT on OpenBSD, to allow /nslookup to build. (caf) diff --git a/source/network.c b/source/network.c index 748d69f..d2666b3 100644 --- a/source/network.c +++ b/source/network.c @@ -639,10 +639,11 @@ int lame_resolv (const char *hostname, struct sockaddr_foobar *buffer) { #ifdef IPV6 struct addrinfo *res; - if (getaddrinfo(hostname, NULL, NULL, &res) && res) + if (getaddrinfo(hostname, NULL, NULL, &res) || !res) return -1; memmove(buffer, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); return 0; #else struct hostent *hp;