X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fir%2Fstream.c;h=4339010e1846f1b8a7fbbcbbac9a01b8e24e0a79;hb=b25d20adeabe34126cacaf6b7f93883c1c98ad90;hp=517a11e63e00d89fffb76f11cb76f53e32dca948;hpb=5fd2e9fda6185e989583e6e61b9312683149747e;p=babeltrace.git diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 517a11e6..4339010e 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -362,7 +362,8 @@ int bt_ctf_stream_get_discarded_events_count( struct bt_ctf_field *events_discarded_field = NULL; struct bt_ctf_field_type *events_discarded_field_type = NULL; - if (!stream || !count || !stream->packet_context) { + if (!stream || !count || !stream->packet_context || + stream->pos.fd < 0) { ret = -1; goto end; } @@ -425,7 +426,7 @@ void bt_ctf_stream_append_discarded_events(struct bt_ctf_stream *stream, struct bt_ctf_field *events_discarded_field = NULL; struct bt_ctf_field_type *events_discarded_field_type = NULL; - if (!stream || !stream->packet_context) { + if (!stream || !stream->packet_context || stream->pos.fd < 0) { goto end; } @@ -478,7 +479,7 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, { int ret = 0; - if (!stream || !event) { + if (!stream || !event || stream->pos.fd < 0) { ret = -1; goto end; } @@ -495,7 +496,8 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, goto end; } - /* Save the new event */ + /* Save the new event and freeze it */ + bt_ctf_event_freeze(event); g_ptr_array_add(stream->events, event); /* @@ -521,7 +523,7 @@ struct bt_ctf_field *bt_ctf_stream_get_packet_context( { struct bt_ctf_field *packet_context = NULL; - if (!stream) { + if (!stream || stream->pos.fd < 0) { goto end; } @@ -539,7 +541,7 @@ int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream, int ret = 0; struct bt_ctf_field_type *field_type; - if (!stream || !field) { + if (!stream || !field || stream->pos.fd < 0) { ret = -1; goto end; } @@ -564,7 +566,7 @@ struct bt_ctf_field *bt_ctf_stream_get_packet_header( { struct bt_ctf_field *packet_header = NULL; - if (!stream) { + if (!stream || stream->pos.fd < 0) { goto end; } @@ -583,7 +585,7 @@ int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream, struct bt_ctf_trace *trace = NULL; struct bt_ctf_field_type *field_type = NULL; - if (!stream || !field) { + if (!stream || !field || stream->pos.fd < 0) { ret = -1; goto end; }