From: hno <> Date: Wed, 13 Feb 2002 07:50:34 +0000 (+0000) Subject: Plugged two SNMP memory leaks. X-Git-Tag: SQUID_3_0_PRE1~1196 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f0dc2645cf2444f9d20952a66316b495dd91e1c;p=thirdparty%2Fsquid.git Plugged two SNMP memory leaks. One small for the community string One larger (4K) for the eventual response --- diff --git a/src/snmp_core.cc b/src/snmp_core.cc index edf6076e63..a6da57457f 100644 --- a/src/snmp_core.cc +++ b/src/snmp_core.cc @@ -1,6 +1,6 @@ /* - * $Id: snmp_core.cc,v 1.51 2001/08/30 09:51:40 hno Exp $ + * $Id: snmp_core.cc,v 1.52 2002/02/13 00:50:34 hno Exp $ * * DEBUG: section 49 SNMP support * AUTHOR: Glenn Chisholm @@ -482,6 +482,7 @@ snmpHandleUdp(int sock, void *not_used) snmp_rq->outbuf = xmalloc(snmp_rq->outlen = SNMP_REQUEST_SIZE); xmemcpy(&snmp_rq->from, &from, sizeof(struct sockaddr_in)); snmpDecodePacket(snmp_rq); + xfree(snmp_rq->outbuf); xfree(snmp_rq); } else { debug(49, 1) ("snmpHandleUdp: FD %d recvfrom: %s\n", sock, xstrerror()); @@ -523,6 +524,8 @@ snmpDecodePacket(snmp_request_t * rq) inet_ntoa(rq->from.sin_addr)); snmp_free_pdu(PDU); } + if (Community) + free(Community); } /* @@ -544,7 +547,6 @@ snmpConstructReponse(snmp_request_t * rq) snmp_build(&Session, RespPDU, rq->outbuf, &rq->outlen); sendto(rq->sock, rq->outbuf, rq->outlen, 0, (struct sockaddr *) &rq->from, sizeof(rq->from)); snmp_free_pdu(RespPDU); - xfree(rq->outbuf); } }