Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 09:43:35 +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: r310892 - head/usr.sbin/bsnmpd/tools/bsnmptools
Message-ID:  <201612310943.uBV9hZNk007049@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Dec 31 09:43:35 2016
New Revision: 310892
URL: https://svnweb.freebsd.org/changeset/base/310892

Log:
  Don't call snmp_pdu_free(..) until finished with the pdu and when ready to
  allocate a new one via snmp_pdu_create(..)
  
  This fixes bsnmpwalk, so it no longer crashes after r310729
  
  X-MFC with:	r310729
  MFC after:	12 days

Modified:
  head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c

Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c
==============================================================================
--- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c	Sat Dec 31 07:50:14 2016	(r310891)
+++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c	Sat Dec 31 09:43:35 2016	(r310892)
@@ -498,7 +498,6 @@ snmptool_walk(struct snmp_toolinfo *snmp
 			}
 
 			outputs += rc;
-			snmp_pdu_free(&resp);
 
 			if ((u_int)rc < resp.nbindings)
 				break;
@@ -518,8 +517,6 @@ snmptool_walk(struct snmp_toolinfo *snmp
 					snmp_output_err_resp(snmptoolctx, &resp);
 				else
 					snmp_output_resp(snmptoolctx, &(resp), NULL);
-
-				snmp_pdu_free(&resp);
 			} else
 				warn("Snmp dialog");
 		}
@@ -529,6 +526,8 @@ snmptool_walk(struct snmp_toolinfo *snmp
 			break;
 		}
 
+		snmp_pdu_free(&resp);
+
 		snmp_pdu_create(&req, op);
 	}
 



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