From: Jérémie Galarneau Date: Fri, 26 Feb 2021 19:02:06 +0000 (-0500) Subject: Fix: lttng: add-trigger: leak of source argument X-Git-Tag: v2.13.0-rc1~306 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=6e61d0fa0123bbf215a8c00567edd6f94b5f88ac;p=lttng-tools.git Fix: lttng: add-trigger: leak of source argument 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 --- 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: