Cleanup: packet-context-field.c: logically dead code
[babeltrace.git] / src / lib / trace-ir / packet-context-field.c
index c03e1eae331de44e76404c0ff5dd6e7b75a52461..786cbdf6a76aa24b12f8a93a39abf11d3a28d30b 100644 (file)
@@ -63,6 +63,9 @@ struct bt_packet_context_field *bt_packet_context_field_create(
        struct bt_field_wrapper *field_wrapper;
 
        BT_ASSERT_PRE_NON_NULL(stream_class, "Stream class");
+       BT_ASSERT_PRE(stream_class->supports_packets,
+               "Stream class does not support packets: %![sc-]+S",
+               stream_class);
        BT_ASSERT_PRE(stream_class->packet_context_fc,
                "Stream class has no packet context field class: %!+S",
                stream_class);
@@ -70,20 +73,14 @@ struct bt_packet_context_field *bt_packet_context_field_create(
                &stream_class->packet_context_field_pool,
                (void *) stream_class->packet_context_fc);
        if (!field_wrapper) {
-               BT_LIB_LOGE("Cannot allocate one packet context field from stream class: "
+               BT_LIB_LOGE_APPEND_CAUSE(
+                       "Cannot allocate one packet context field from stream class: "
                        "%![sc-]+S", stream_class);
-               goto error;
+               goto end;
        }
 
        BT_ASSERT(field_wrapper->field);
        bt_stream_class_freeze(stream_class);
-       goto end;
-
-error:
-       if (field_wrapper) {
-               bt_field_wrapper_destroy(field_wrapper);
-               field_wrapper = NULL;
-       }
 
 end:
        return (void *) field_wrapper;
This page took 0.025853 seconds and 4 git commands to generate.