From 9fa6c43789adb788c5f03289b54553fb1b64edd7 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Fri, 28 May 2021 14:32:37 -0400 Subject: [PATCH] Fix: lttng_triggers count is not equal to the size of the sorted trigger array MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Since anonymous triggers can be present in the original lttng_triggers and that we do not add them to the sorting list, the count to be used while iterating on the sorted list must be the size of the list itself and not that of lttng_triggers. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: Ifb1802345199cb20fbb6d401f316be918b8a6443 --- src/bin/lttng/commands/list_triggers.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/bin/lttng/commands/list_triggers.c b/src/bin/lttng/commands/list_triggers.c index 59db1c5d4..a34323b5e 100644 --- a/src/bin/lttng/commands/list_triggers.c +++ b/src/bin/lttng/commands/list_triggers.c @@ -1191,9 +1191,10 @@ static int print_sorted_triggers(const struct lttng_triggers *triggers) sizeof(struct lttng_trigger *), compare_triggers_by_name); - for (i = 0; i < num_triggers; i++) { - const struct lttng_trigger *trigger_to_print = - (const struct lttng_trigger *) + for (i = 0; i < lttng_dynamic_pointer_array_get_count(&sorted_triggers); + i++) { + const struct lttng_trigger *trigger_to_print = (const struct lttng_trigger + *) lttng_dynamic_pointer_array_get_pointer( &sorted_triggers, i); -- 2.34.1