Fix: lttng: list-trigger: leak of error query in query callbacks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 5 Jul 2021 18:18:27 +0000 (14:18 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 6 Jul 2021 21:48:00 +0000 (17:48 -0400)
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 <jeremie.galarneau@efficios.com>
Change-Id: I4e2cde41d77e5299d1758e8c9387b0a1c63efd17

src/bin/lttng/commands/list_triggers.c

index a34323b5e158a268d067e13fb02bf742ce4c9838..0ef94f83677d93a673ba7b343af54c3418afff9d 100644 (file)
@@ -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;
This page took 0.026358 seconds and 4 git commands to generate.