Merge branch 'collectd-4.10' into collectd-5.3
[collectd.git] / src / snmp.c
index b90e0ff..7d340d1 100644 (file)
@@ -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,9 +1439,8 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
     snmp_free_pdu (res);
   res = NULL;
 
-  /*
-   * memory is handled by snmp_synch_response
-   */
+  if (req != NULL)
+    snmp_free_pdu (req);
   req = NULL;
 
   if (status == 0)