X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fsnmp.c;h=ae41d03ae8562781a5ba0f7ec1ff155666f63795;hb=ae5cca244ff291c17df1cc36e28f19376958a2eb;hp=cb0b70fa15275360feab4ac8df55b8b479c03f74;hpb=d8a02e6c6f5875dfcab7b011d1f340e3a13c9e39;p=collectd.git diff --git a/src/snmp.c b/src/snmp.c index cb0b70fa..ae41d03a 100644 --- a/src/snmp.c +++ b/src/snmp.c @@ -656,7 +656,10 @@ static int csnmp_config_add_host (oconfig_item_t *ci) status = cf_util_get_string(ci, &hd->name); if (status != 0) + { + sfree (hd); return status; + } hd->sess_handle = NULL; hd->interval = 0; @@ -928,8 +931,7 @@ static value_t csnmp_value_list_to_value (struct variable_list *vl, int type, tmp_unsigned = (uint32_t) *vl->val.integer; tmp_signed = (int32_t) *vl->val.integer; - if ((vl->type == ASN_INTEGER) - || (vl->type == ASN_GAUGE)) + if (vl->type == ASN_INTEGER) prefer_signed = 1; DEBUG ("snmp plugin: Parsed int32 value is %"PRIu64".", tmp_unsigned); @@ -1377,7 +1379,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; @@ -1735,6 +1737,7 @@ static int csnmp_read_value (host_definition_t *host, data_definition_t *data) res = NULL; sfree (errstr); + sfree (vl.values); csnmp_host_close_session (host); return (-1);