summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 111a5eb)
raw | patch | inline | side by side (parent: 111a5eb)
author | Florian Forster <octo@noris.net> | |
Mon, 18 Aug 2008 08:48:21 +0000 (10:48 +0200) | ||
committer | Florian Forster <octo@noris.net> | |
Mon, 18 Aug 2008 08:48:21 +0000 (10:48 +0200) |
The result was not freed when `csnmp_instance_list_add' failed. This
rarely happens in 4.3, but later versions will be more strict in the
function, so this became a problem.
rarely happens in 4.3, but later versions will be more strict in the
function, so this became a problem.
src/snmp.c | patch | blob | history |
diff --git a/src/snmp.c b/src/snmp.c
index 460624b4e4a2f8bd9be1b7ca22a6dfa2ec15b192..408defa9b4ea385336d66d429d10560422fb6b59 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -1120,10 +1120,6 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
vb = res->variables;
if (vb == NULL)
{
- if (res != NULL)
- snmp_free_pdu (res);
- res = NULL;
-
status = -1;
break;
}
@@ -1132,10 +1128,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
* subtree */
if (csnmp_check_res_left_subtree (host, data, res) != 0)
{
- if (res != NULL)
- snmp_free_pdu (res);
- res = NULL;
-
+ status = 0;
break;
}
@@ -1157,11 +1150,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
(vb != NULL) && (vb->next_variable != NULL);
vb = vb->next_variable)
/* do nothing */;
- if (vb == NULL)
- {
- status = -1;
- break;
- }
+ assert (vb != NULL);
/* Copy OID to oid_list[data->values_len] */
memcpy (oid_list[data->values_len].oid, vb->name,
@@ -1224,6 +1213,10 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
res = NULL;
} /* while (status == 0) */
+ if (res != NULL)
+ snmp_free_pdu (res);
+ res = NULL;
+
if (status == 0)
csnmp_dispatch_table (host, data, instance_list, value_table);