From: Jérémie Galarneau Date: Mon, 5 Jul 2021 18:18:27 +0000 (-0400) Subject: Fix: lttng: list-trigger: leak of error query in query callbacks X-Git-Tag: v2.13.0-rc3~18 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=82f1ada0c72f32198c0b1c6dc804316e41ddac13;p=lttng-tools.git Fix: lttng: list-trigger: leak of error query in query callbacks 1457841 Resource leak The system resource will not be reclaimed and reused, reducing the future availability of the resource. In mi_error_query_trigger_callback: Leak of memory or pointers to system resources (CWE-404) Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: I4e2cde41d77e5299d1758e8c9387b0a1c63efd17 --- diff --git a/src/bin/lttng/commands/list_triggers.c b/src/bin/lttng/commands/list_triggers.c index a34323b5e..0ef94f836 100644 --- a/src/bin/lttng/commands/list_triggers.c +++ b/src/bin/lttng/commands/list_triggers.c @@ -1241,6 +1241,7 @@ static enum lttng_error_code mi_error_query_trigger_callback( lttng_strerror(-ret_code)); } + lttng_error_query_destroy(query); return ret_code; } @@ -1274,6 +1275,8 @@ static enum lttng_error_code mi_error_query_action_callback( trigger_name, (int) trigger_uid, lttng_strerror(-ret_code)); } + + lttng_error_query_destroy(query); return ret_code; } @@ -1307,8 +1310,10 @@ static enum lttng_error_code mi_error_query_condition_callback( lttng_strerror(-ret_code)); } + lttng_error_query_destroy(query); return ret_code; } + int cmd_list_triggers(int argc, const char **argv) { int ret;