From owner-svn-src-head@freebsd.org Sat Dec 31 23:20:58 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A882FC99B06; Sat, 31 Dec 2016 23:20:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750441282; Sat, 31 Dec 2016 23:20:58 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBVNKvZe049457; Sat, 31 Dec 2016 23:20:57 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBVNKvTF049456; Sat, 31 Dec 2016 23:20:57 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612312320.uBVNKvTF049456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 31 Dec 2016 23:20:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310988 - head/contrib/bsnmp/lib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Dec 2016 23:20:58 -0000 Author: ngie Date: Sat Dec 31 23:20:57 2016 New Revision: 310988 URL: https://svnweb.freebsd.org/changeset/base/310988 Log: snmp_discover_engine: fix up req/resp (PDU object) handling a bit - Call snmp_pdu_free on req and resp when done with the objects - Call snmp_pdu_free on req before calling snmp_pdu_create on it again MFC after: 1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c ============================================================================== --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 22:46:17 2016 (r310987) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 31 23:20:57 2016 (r310988) @@ -1793,12 +1793,14 @@ snmp_discover_engine(char *passwd) return (0); } + snmp_pdu_free(&req); + snmp_pdu_create(&req, SNMP_PDU_GET); req.engine.engine_boots = 0; req.engine.engine_time = 0; if (snmp_dialog(&req, &resp) == -1) - return (-1); + return (-1); if (resp.version != req.version) { seterr(&snmp_client, "wrong version"); @@ -1813,6 +1815,9 @@ snmp_discover_engine(char *passwd) snmp_client.engine.engine_boots = resp.engine.engine_boots; snmp_client.engine.engine_time = resp.engine.engine_time; + snmp_pdu_free(&req); + snmp_pdu_free(&resp); + return (0); }