Re: SNMP related memory leaks

From: Radu Greab <radu@dont-contact.us>
Date: Fri, 1 Jun 2001 17:53:59 +0300

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 Fri Jun 01 2001 - 08:54:15 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:02 MST