From d65c57ea907e8e547f0b834fed45a559885316d7 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 22 Oct 2024 16:15:40 -0400 Subject: [PATCH] Fix: lib: initialize `bt_field_class_bit_array::label_buf` This field is never assigned, so we crash when trying to use it. Change-Id: Ib283031ac0f12ecfae53c7b1e77eb1b685d06791 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/13396 Reviewed-by: Philippe Proulx --- src/lib/trace-ir/field-class.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/trace-ir/field-class.c b/src/lib/trace-ir/field-class.c index 92eacee2..32cc4a0e 100644 --- a/src/lib/trace-ir/field-class.c +++ b/src/lib/trace-ir/field-class.c @@ -147,6 +147,12 @@ struct bt_field_class *bt_field_class_bit_array_create( goto error; } + ba_fc->label_buf = g_ptr_array_new(); + if (!ba_fc->label_buf) { + BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray."); + goto error; + } + BT_LIB_LOGD("Created bit array field class object: %!+F", ba_fc); goto end; -- 2.34.1