From: Jérémie Galarneau Date: Fri, 31 Jan 2020 23:04:49 +0000 (-0500) Subject: Fix: unchecked return value of cds_lfht_destroy() X-Git-Tag: v2.12.0-rc1~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b7e1aba3b4ca20d7efd006f2c0485eb3408ea80e;p=lttng-tools.git Fix: unchecked return value of cds_lfht_destroy() 1412202 Unchecked return value If the function returns an error value, the error value may be mistaken for a normal value. In lttng_tracker_list_destroy: Value returned from a function is not checked for errors before being used (CWE-252) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I85c994440bc2cd5df0545fd1364dab462f98bc1c --- diff --git a/src/bin/lttng-sessiond/tracker.c b/src/bin/lttng-sessiond/tracker.c index 15779ce72..302971767 100644 --- a/src/bin/lttng-sessiond/tracker.c +++ b/src/bin/lttng-sessiond/tracker.c @@ -225,11 +225,14 @@ end: void lttng_tracker_list_destroy(struct lttng_tracker_list *tracker_list) { + int ret; + if (!tracker_list) { return; } lttng_tracker_list_reset(tracker_list); - cds_lfht_destroy(tracker_list->ht, NULL); + ret = cds_lfht_destroy(tracker_list->ht, NULL); + assert(!ret); free(tracker_list); }