Fix: lttng-sessiond: kernel: leak of event notifier rule
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Mar 2021 17:00:09 +0000 (13:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 Mar 2021 17:00:12 +0000 (13:00 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I58862b3b38c7e61806e0047840bf68619273db49

src/bin/lttng-sessiond/kernel.c

index bad864db05c4b56d35c0f6579c6764cfc5ffd605..03a358a0d3f1da9478ef220c3e93309298b469f7 100644 (file)
@@ -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:
This page took 0.036601 seconds and 4 git commands to generate.