From 6e61d0fa0123bbf215a8c00567edd6f94b5f88ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 26 Feb 2021 14:02:06 -0500 Subject: [PATCH] Fix: lttng: add-trigger: leak of source argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 1447045 Resource leak The system resource will not be reclaimed and reused, reducing the future availability of the resource. In parse_event_rule: Leak of memory or pointers to system resources (CWE-404) Signed-off-by: Jérémie Galarneau Change-Id: Idbef8b229f62856f11eb3f8f9ed296e21fd7cad6 --- src/bin/lttng/commands/add_trigger.c | 1 + src/common/uri.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index 2a7b29d52..eecda5014 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -789,6 +789,7 @@ end: free(filter); free(exclude); free(loglevel_str); + free(source); strutils_free_null_terminated_array_of_strings(exclusion_list); lttng_kernel_probe_location_destroy(kernel_probe_location); lttng_userspace_probe_location_destroy(userspace_probe_location); diff --git a/src/common/uri.c b/src/common/uri.c index 0f89468c5..d22e56e01 100644 --- a/src/common/uri.c +++ b/src/common/uri.c @@ -514,6 +514,7 @@ end: free(addr_f); *uris = tmp_uris; + assert(size == 1 || size == 2); return size; free_error: -- 2.34.1