X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Ftable.c;h=d798820763f96335a204bcc2afb7a6d3536e508d;hb=0d9f395599348e735e6f461e1c328293bef0d060;hp=7cae3f79d9f88555c0c6c1b0165a7c62a36e1be3;hpb=3d082a905619c19ca5b7183bb95a30d4d9529c4d;p=collectd.git diff --git a/src/table.c b/src/table.c index 7cae3f79..d7988207 100644 --- a/src/table.c +++ b/src/table.c @@ -78,6 +78,10 @@ static void tbl_result_setup(tbl_result_t *res) { } /* tbl_result_setup */ static void tbl_result_clear(tbl_result_t *res) { + if (res == NULL) { + return; + } + sfree(res->type); sfree(res->instance_prefix); @@ -103,11 +107,17 @@ static void tbl_setup(tbl_t *tbl, char *file) { } /* tbl_setup */ static void tbl_clear(tbl_t *tbl) { + if (tbl == NULL) { + return; + } + sfree(tbl->file); sfree(tbl->sep); sfree(tbl->plugin_name); sfree(tbl->instance); + /* (tbl->results == NULL) -> (tbl->results_num == 0) */ + assert((tbl->results != NULL) || (tbl->results_num == 0)); for (size_t i = 0; i < tbl->results_num; ++i) tbl_result_clear(tbl->results + i); sfree(tbl->results);