Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jan 2017 08:49:06 +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: r311390 - head/contrib/bsnmp/lib
Message-ID:  <201701050849.v058n60V082297@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Thu Jan  5 08:49:06 2017
New Revision: 311390
URL: https://svnweb.freebsd.org/changeset/base/311390

Log:
  snmp_table_fetch_async: don't leak `work` if snmp_pdu_send(..) fails
  
  MFC after:	1 week
  Reported by:	Coverity
  CID:		1017276

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

Modified: head/contrib/bsnmp/lib/snmpclient.c
==============================================================================
--- head/contrib/bsnmp/lib/snmpclient.c	Thu Jan  5 08:42:58 2017	(r311389)
+++ head/contrib/bsnmp/lib/snmpclient.c	Thu Jan  5 08:49:06 2017	(r311390)
@@ -728,8 +728,11 @@ snmp_table_fetch_async(const struct snmp
 	work->last_change = 0;
 	table_init_pdu(descr, &work->pdu);
 
-	if (snmp_pdu_send(&work->pdu, table_cb, work) == -1)
+	if (snmp_pdu_send(&work->pdu, table_cb, work) == -1) {
+		free(work);
+		work = NULL;
 		return (-1);
+	}
 	return (0);
 }
 



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