From: Jonathan Rajotte Date: Fri, 28 May 2021 18:32:37 +0000 (-0400) Subject: Fix: lttng_triggers count is not equal to the size of the sorted trigger array X-Git-Tag: v2.13.0-rc3~33 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=3bac951b4b8d8f90b97238cf1cc3ea68d1a2e83d;p=lttng-tools.git Fix: lttng_triggers count is not equal to the size of the sorted trigger array 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 --- 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);