svn commit: r300665 - head/lib/libfetch
Don Lewis
truckman at FreeBSD.org
Wed May 25 07:39:50 UTC 2016
Author: truckman
Date: Wed May 25 07:39:48 2016
New Revision: 300665
URL: https://svnweb.freebsd.org/changeset/base/300665
Log:
Don't leak addrinfo in fetch_bind()
Reported by: Coverity
CID: 1225038
MFC after: 1 week
Modified:
head/lib/libfetch/common.c
Modified: head/lib/libfetch/common.c
==============================================================================
--- head/lib/libfetch/common.c Wed May 25 07:26:22 2016 (r300664)
+++ head/lib/libfetch/common.c Wed May 25 07:39:48 2016 (r300665)
@@ -256,8 +256,11 @@ fetch_bind(int sd, int af, const char *a
if ((err = getaddrinfo(addr, NULL, &hints, &res0)) != 0)
return (-1);
for (res = res0; res; res = res->ai_next)
- if (bind(sd, res->ai_addr, res->ai_addrlen) == 0)
+ if (bind(sd, res->ai_addr, res->ai_addrlen) == 0) {
+ freeaddrinfo(res0);
return (0);
+ }
+ freeaddrinfo(res0);
return (-1);
}
More information about the svn-src-head
mailing list