ir: add tests for duplicate event classes
[babeltrace.git] / formats / ctf / ir / stream.c
index a903264963572ecc89279cb4b8f14781687ce909..858cd98b02865ef25266111fe3d14b8e224ed107 100644 (file)
@@ -312,6 +312,9 @@ struct bt_ctf_stream *bt_ctf_stream_create(
        /* A trace is not allowed to have a NULL packet header */
        assert(trace->packet_header_type);
        stream->packet_header = bt_ctf_field_create(trace->packet_header_type);
+       if (!stream->packet_header) {
+               goto error_destroy;
+       }
        /*
         * Attempt to populate the default trace packet header fields
         * (magic, uuid and stream_id). This will _not_ fail shall the
@@ -910,7 +913,7 @@ void bt_ctf_stream_destroy(struct bt_ctf_ref *ref)
 
        stream = container_of(ref, struct bt_ctf_stream, ref_count);
        ctf_fini_pos(&stream->pos);
-       if (close(stream->pos.fd)) {
+       if (stream->pos.fd >= 0 && close(stream->pos.fd)) {
                perror("close");
        }
 
This page took 0.023339 seconds and 4 git commands to generate.