Fix: lib: initialize `bt_field_class_bit_array::label_buf`
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 22 Oct 2024 20:15:40 +0000 (16:15 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 4 Nov 2024 16:17:44 +0000 (11:17 -0500)
This field is never assigned, so we crash when trying to use it.

Change-Id: Ib283031ac0f12ecfae53c7b1e77eb1b685d06791
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/13396
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/trace-ir/field-class.c

index 92eacee2d6ba6e10a6c19791f0cd7d1273c4b36a..32cc4a0e5f460493a7ccef8ae95ec1a10ac6bbb7 100644 (file)
@@ -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;
 
This page took 0.025375 seconds and 4 git commands to generate.