Fix: ctf-writer: stream-class.c: Dereference after null check
[babeltrace.git] / src / ctf-writer / stream-class.c
index ffec66557f991456a8ecdf4a8dfc4f09731e247f..2d3b2fbae70e51448d51304196a82e0eec19e56c 100644 (file)
@@ -613,7 +613,7 @@ int init_packet_context(struct bt_ctf_stream_class *stream_class)
                bt_ctf_field_type_structure_create();
        struct bt_ctf_field_type *_uint64_t =
                get_field_type(FIELD_TYPE_ALIAS_UINT64_T);
-       struct bt_ctf_field_type *ts_begin_end_uint64_t;
+       struct bt_ctf_field_type *ts_begin_end_uint64_t = NULL;
 
        if (!packet_context_type) {
                BT_LOGE_STR("Cannot create empty structure field type.");
@@ -776,6 +776,8 @@ int try_map_clock_class(struct bt_ctf_stream_class *stream_class,
                if (!ft_copy) {
                        BT_LOGE("Failed to copy integer field type: ft-addr=%p",
                                ft);
+                       ret = -1;
+                       goto end;
                }
 
                ret = bt_ctf_field_type_common_integer_set_mapped_clock_class_no_check_frozen(
This page took 0.025936 seconds and 4 git commands to generate.