From a55f8ad13c4e5a261f37793236403449399f973f Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 7 Apr 2021 12:07:43 -0400 Subject: [PATCH] Fix: sessiond: error accounting: leak of cpu_counter array on error path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-sessiond/event-notifier-error-accounting.c | 2 ++ 1 file changed, 2 insertions(+) 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); -- 2.34.1