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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to