Author: ngie
Date: Mon Mar 20 17:17:54 2017
New Revision: 315641
URL: https://svnweb.freebsd.org/changeset/base/315641

Log:
  bsnmp: don't leak snmp_client.fd in open_client_udp(..) on connect(2) failure
  
  MFC after:    1 week
  Sponsored by: Dell EMC Isilon

Modified:
  head/contrib/bsnmp/lib/snmpclient.c

Modified: head/contrib/bsnmp/lib/snmpclient.c
==============================================================================
--- head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 16:44:55 2017        
(r315640)
+++ head/contrib/bsnmp/lib/snmpclient.c Mon Mar 20 17:17:54 2017        
(r315641)
@@ -947,6 +947,8 @@ open_client_udp(const char *host, const 
                        if ((res = res->ai_next) == NULL) {
                                seterr(&snmp_client, "%s", strerror(errno));
                                freeaddrinfo(res0);
+                               (void)close(snmp_client.fd);
+                               snmp_client.fd = -1;
                                return (-1);
                        }
                } else
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to