summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 23ef1ee)
raw | patch | inline | side by side (parent: 23ef1ee)
author | Florian Forster <octo@collectd.org> | |
Thu, 18 Jun 2015 13:27:54 +0000 (15:27 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 18 Jun 2015 13:27:54 +0000 (15:27 +0200) |
src/snmp.c | patch | blob | history | |
src/utils_db_query.c | patch | blob | history |
diff --git a/src/snmp.c b/src/snmp.c
index 3dd08e4adacde990e28847925627f2a442986fe7..4dd1d10cd11381873eb0b8ef3423548f7ee9eb73 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
@@ -1241,6 +1241,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
data->type, ds->ds_num, data->values_len);
return (-1);
}
+ assert (data->values_len > 0);
/* We need a copy of all the OIDs, because GETNEXT will destroy them. */
memcpy (oid_list, data->values, data->values_len * sizeof (oid_t));
diff --git a/src/utils_db_query.c b/src/utils_db_query.c
index ab4299b3a84675e8be8fdc2adfdf7ca879d807fe..e8d7b3aa88509a5fdf38708470b9615c33aa73bf 100644 (file)
--- a/src/utils_db_query.c
+++ b/src/utils_db_query.c
assert (r != NULL);
assert (r_area->ds != NULL);
assert (((size_t) r_area->ds->ds_num) == r->values_num);
+ assert (r->values_num > 0);
- vl.values = (value_t *) calloc (r_area->ds->ds_num, sizeof (value_t));
+ vl.values = (value_t *) calloc (r->values_num, sizeof (value_t));
if (vl.values == NULL)
{
ERROR ("db query utils: malloc failed.");