snmp plugin: res can't be NULL here
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 23 Apr 2016 09:07:38 +0000 (11:07 +0200)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Sat, 23 Apr 2016 09:07:38 +0000 (11:07 +0200)
[src/snmp.c:1761] -> [src/snmp.c:1777]: (warning) Either the condition 'res!=0' is redundant or there is possible null pointer dereference: res.

src/snmp.c

index 8b21907..0e2af3b 100644 (file)
@@ -1774,9 +1774,7 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data)
             data->scale, data->shift, host->name, data->name);
   } /* for (res->variables) */
 
-  if (res != NULL)
-    snmp_free_pdu (res);
-  res = NULL;
+  snmp_free_pdu (res);
 
   DEBUG ("snmp plugin: -> plugin_dispatch_values (&vl);");
   plugin_dispatch_values (&vl);