summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6df8e68)
raw | patch | inline | side by side (parent: 6df8e68)
author | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 19 Nov 2014 16:30:17 +0000 (17:30 +0100) | ||
committer | Pierre-Yves Ritschard <pyr@spootnik.org> | |
Wed, 19 Nov 2014 16:32:13 +0000 (17:32 +0100) |
We might as well mess with avoid freeing the req pointer
only when failures occur, otherwise perform as before
only when failures occur, otherwise perform as before
src/snmp.c | patch | blob | history |
diff --git a/src/snmp.c b/src/snmp.c
index 6466503bd390887a674944f441c7c47e5f3550ed..ab5963858afed60e309e0256e8b10abdaebc7fab 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -359,7 +359,7 @@ static int csnmp_config_add_data_blacklist(data_definition_t *dd, oconfig_item_t
{
ERROR("snmp plugin: Can't allocate memory");
strarray_free(dd->ignores, dd->ignores_len);
- return (ENOMEM);
+ return (ENOMEM);
}
}
return 0;
@@ -1497,6 +1497,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);
@@ -1618,9 +1620,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)