]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
snmp plugin: don't read from uninitialized pointer 1406/head
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 4 Dec 2015 18:31:16 +0000 (19:31 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Fri, 4 Dec 2015 18:31:16 +0000 (19:31 +0100)
if the first snmp_pdu_create inside the loop returns an error,
we exit the loop with res uninitialized and then call snmp_free_pdu on it.

CID #38037

src/snmp.c

index 0717365a9694de0c402dbe7f12dfae8ff705431e..8df7edd40a2e173abd3bceb065ecaf0cda4e7d77 100644 (file)
@@ -1398,7 +1398,7 @@ static int csnmp_dispatch_table (host_definition_t *host, data_definition_t *dat
 static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
 {
   struct snmp_pdu *req;
-  struct snmp_pdu *res;
+  struct snmp_pdu *res = NULL;
   struct variable_list *vb;
 
   const data_set_t *ds;