From: Florian Forster Date: Mon, 20 Nov 2017 13:19:46 +0000 (+0100) Subject: table plugin: Assert that result_num is zero when result is NULL. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=dfe33d435b2c29f7376507463700c5d4d07f3dfa;p=collectd.git table plugin: Assert that result_num is zero when result is NULL. The Coverity check gets confused by the `tbl->results == NULL` check: due to the check, is assumes that tbl->results *may* be NULL. It then discovers the dereference in tbl_clear() without realizing that "result" and "result_num" are linked and that situation can't happen. This assertion makes this link a bit easier to conclude. CID: 37966 --- diff --git a/src/table.c b/src/table.c index 3e8feada..cebcaed0 100644 --- a/src/table.c +++ b/src/table.c @@ -279,6 +279,7 @@ static int tbl_config_table(oconfig_item_t *ci) { } if (NULL == tbl->results) { + assert(tbl->results_num == 0); log_err("Table \"%s\" does not specify any (valid) results.", tbl->file); status = 1; }