Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 2017 17:17:54 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315641 - head/contrib/bsnmp/lib
Message-ID:  <201703201717.v2KHHstt026835@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703201717.v2KHHstt026835>