commit 8db20d8fe15c19b83ae87b369a6c2f62dcaa603f Author: Heman Muresan Date: Fri Jun 9 16:11:05 2023 -0400 Addressing assert on lttng list-triggers This was seemingly introduced by this commit: https://github.com/lttng/lttng-tools/commit/1ad48d9678f8f123dc7d44dbbfadc9957b7e970e#diff-e9fa6863d3580e2d95137ddaab0280d5391e830657a46f47cde39e0cfabc8fb7R109 diff --git a/src/common/actions/path.c b/src/common/actions/path.c index 250b5e905..78172ddcc 100644 --- a/src/common/actions/path.c +++ b/src/common/actions/path.c @@ -99,22 +99,31 @@ LTTNG_HIDDEN int lttng_action_path_copy(const struct lttng_action_path *src, struct lttng_action_path **dst) { - int ret; + int ret = 0; struct lttng_action_path *new_path; + size_t src_count = 0; assert(src); assert(dst); - new_path = lttng_action_path_create( + src_count = lttng_dynamic_array_get_count(&src->indexes); + if (src_count > 0) { + new_path = lttng_action_path_create( (uint64_t *) lttng_dynamic_array_get_element( &src->indexes, 0), lttng_dynamic_array_get_count(&src->indexes)); - if (!new_path) { - ret = -1; - } else { - ret = 0; - *dst = new_path; - } + if (!new_path) { + ret = -1; + } else { + ret = 0; + *dst = new_path; + } + } + else + { + *dst = lttng_action_path_create(NULL, 0); + ret = 0; + } return ret; }