svn commit: r301153 - stable/10/lib/libfetch

Don Lewis truckman at FreeBSD.org
Wed Jun 1 17:43:05 UTC 2016


Author: truckman
Date: Wed Jun  1 17:43:04 2016
New Revision: 301153
URL: https://svnweb.freebsd.org/changeset/base/301153

Log:
  MFC r300665
  
  Don't leak addrinfo in fetch_bind()
  
  Submitted by:	Coverity
  CID:		1225038

Modified:
  stable/10/lib/libfetch/common.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libfetch/common.c
==============================================================================
--- stable/10/lib/libfetch/common.c	Wed Jun  1 17:41:00 2016	(r301152)
+++ stable/10/lib/libfetch/common.c	Wed Jun  1 17:43:04 2016	(r301153)
@@ -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-all mailing list