Package: collectd
Version: 5.4.1-5
Severity: important
Tags: patch

Dear Maintainer,

collectd leaks memory when monitoring more than one SNMP device. This
quickly leads to resource exhaustion on the machine running collectd.
Two patches for this issue will be part of upcoming bugfix release
5.4.2. I've merged them together and I'm attaching the resulting patch
here for your convenience.

I believe this fix should be included in the package shipped with
jessie, as it prevents collectd from saturating the host's memory in a
pretty common situation.

Thanks !
diff --git a/src/snmp.c b/src/snmp.c
index ad81c89..7d340d1 100644
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -1316,6 +1316,8 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
         snmp_free_pdu (res);
       res = NULL;
 
+      /* snmp_synch_response already freed our PDU */
+      req = NULL;
       sfree (errstr);
       csnmp_host_close_session (host);
 
@@ -1437,6 +1439,10 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     snmp_free_pdu (res);
   res = NULL;
 
+  if (req != NULL)
+    snmp_free_pdu (req);
+  req = NULL;
+
   if (status == 0)
     csnmp_dispatch_table (host, data, instance_list_head, value_list_head);
 

Reply via email to