We should probably do a s/xfree/safe_free/ thru out the SNMP code, and
mostly everywhere else xfree is called.
-- Henrik Nordstrom Squid Hacker Radu Greab wrote: > > On Thu, 31 May 2001 21:30 +0300, Radu Greab wrote: > > The patch below fixes another set of memory leaks: > > Unfortunately it has a copy-and-paste error. Please apply the new > revised patch. > > Thank you, > Radu Greab > > Index: src/snmp_core.c > =================================================================== > RCS file: /squid/squid/src/snmp_core.c,v > retrieving revision 1.45.2.2 > diff -u -r1.45.2.2 snmp_core.c > --- src/snmp_core.c 2001/05/27 23:52:21 1.45.2.2 > +++ src/snmp_core.c 2001/05/31 18:20:21 > @@ -482,6 +482,7 @@ > 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 @@ > inet_ntoa(rq->from.sin_addr)); > snmp_free_pdu(PDU); > } > + if (Community) > + xfree(Community); > } > > /* > @@ -545,7 +548,6 @@ > ret = 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); > } > } >Received on Tue Jun 05 2001 - 02:19:35 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:03 MST