From 5d650dcd9e04bcabd53fdf5f3104b93eb82bc0a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 7 Apr 2021 12:04:58 -0400 Subject: [PATCH 1/1] Fix: sessiond: error accounting: dereference of null pointer on error path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1452201 Dereference after null check Either the check against null is unnecessary, or there may be a null pointer dereference. In event_notifier_error_accounting_register_app: Pointer is checked against null but then dereferenced anyway (CWE-476) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I169fd6434606b2a35e076ae9258de6597565effe --- src/bin/lttng-sessiond/event-notifier-error-accounting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index 035f3a036..34dc2b4fe 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -481,7 +481,6 @@ event_notifier_error_accounting_register_app(struct ust_app *app) cpu_counters = NULL; goto end; -error_allocate_cpu_counters: error_send_cpu_counter_data: error_duplicate_cpu_counter: /* Teardown any duplicated cpu counters. */ @@ -498,6 +497,7 @@ error_duplicate_cpu_counter: free(cpu_counters[i]); } +error_allocate_cpu_counters: error_send_counter_data: ustctl_release_object(-1, new_counter); free(new_counter); -- 2.34.1