From e8b1187d0ff0323106069738b2fff5c9e5a7d9bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 22 Mar 2021 13:00:09 -0400 Subject: [PATCH 1/1] Fix: lttng-sessiond: kernel: leak of event notifier rule MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1445768 Resource leak The system resource will not be reclaimed and reused, reducing the future availability of the resource. In kernel_create_event_notifier_rule: Leak of memory or pointers to system resources (CWE-404) Reported by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I58862b3b38c7e61806e0047840bf68619273db49 --- src/bin/lttng-sessiond/kernel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index bad864db0..03a358a0d 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -2408,7 +2408,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule( if (capture_bytecode == NULL) { ERR("Unexpected NULL capture bytecode on condition"); error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL; - goto error; + goto capture_error; } ret = kernctl_capture(event_notifier_rule->fd, capture_bytecode); @@ -2416,7 +2416,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule( ERR("Failed to set capture bytecode on event notifier rule fd: fd = %d", event_notifier_rule->fd); error_code_ret = LTTNG_ERR_KERN_ENABLE_FAIL; - goto error; + goto capture_error; } } @@ -2446,6 +2446,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule( return LTTNG_OK; +capture_error: add_callsite_error: enable_error: set_cloexec_error: -- 2.34.1