From: Jérémie Galarneau Date: Wed, 7 Apr 2021 16:07:43 +0000 (-0400) Subject: Fix: sessiond: error accounting: leak of cpu_counter array on error path X-Git-Tag: v2.13.0-rc1~156 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=a55f8ad13c4e5a261f37793236403449399f973f Fix: sessiond: error accounting: leak of cpu_counter array on error path 1452202 Resource leak The system resource will not be reclaimed and reused, reducing the future availability of the resource. In event_notifier_error_accounting_register_app: Leak of memory or pointers to system resources (CWE-404) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I07cc8808b05c497b9bc3099deca58e14f721c5a1 --- diff --git a/src/bin/lttng-sessiond/event-notifier-error-accounting.c b/src/bin/lttng-sessiond/event-notifier-error-accounting.c index 34dc2b4fe..f0e567f72 100644 --- a/src/bin/lttng-sessiond/event-notifier-error-accounting.c +++ b/src/bin/lttng-sessiond/event-notifier-error-accounting.c @@ -497,6 +497,8 @@ error_duplicate_cpu_counter: free(cpu_counters[i]); } + free(cpu_counters); + error_allocate_cpu_counters: error_send_counter_data: ustctl_release_object(-1, new_counter);