From: Jérémie Galarneau Date: Wed, 10 Feb 2021 19:08:55 +0000 (-0500) Subject: Fix: sessiond: kernel: leak of notifier rule on failure to init notifier X-Git-Tag: v2.13.0-rc1~339 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b5e3b044d898fe910f93d3ffd737c55d4b34e4ab;p=lttng-tools.git Fix: sessiond: kernel: leak of notifier rule on failure to init notifier Coverity reports: 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: Ica3f414fb7640ecddf9affbcc359121b04a82277 --- diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c index dcd33a1b7..2e920286c 100644 --- a/src/bin/lttng-sessiond/kernel.c +++ b/src/bin/lttng-sessiond/kernel.c @@ -2328,7 +2328,7 @@ static enum lttng_error_code kernel_create_event_notifier_rule( error_code_ret = trace_kernel_init_event_notifier_from_event_rule( event_rule, &kernel_event_notifier); if (error_code_ret != LTTNG_OK) { - goto error; + goto free_event; } kernel_event_notifier.event.token = event_notifier_rule->token;