From: Simon Marchi Date: Tue, 22 Oct 2024 20:15:40 +0000 (-0400) Subject: Fix: lib: initialize `bt_field_class_bit_array::label_buf` X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=d65c57ea907e8e547f0b834fed45a559885316d7;p=babeltrace.git 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 --- 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;