From: Jérémie Galarneau Date: Thu, 3 Nov 2016 18:23:51 +0000 (-0400) Subject: Fix: ensure that a stream class is not associated to a trace X-Git-Tag: v2.0.0-pre1~732 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=2789e5d9b2cbbe16af62b703981719b9cae8470f Fix: ensure that a stream class is not associated to a trace Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/trace.c b/formats/ctf/ir/trace.c index 4476c8f0..55967275 100644 --- a/formats/ctf/ir/trace.c +++ b/formats/ctf/ir/trace.c @@ -430,12 +430,20 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, struct bt_ctf_field_type *stream_event_ctx_type = NULL; int event_class_count; struct bt_ctf_clock *clock_to_add_to_trace = NULL; + struct bt_ctf_trace *current_parent_trace = NULL; if (!trace || !stream_class) { ret = -1; goto end; } + current_parent_trace = bt_ctf_stream_class_get_trace(stream_class); + if (current_parent_trace) { + /* Stream class is already associated to a trace, abort. */ + ret = -1; + goto end; + } + event_class_count = bt_ctf_stream_class_get_event_class_count(stream_class); assert(event_class_count >= 0); @@ -668,6 +676,7 @@ end: g_free(ec_validation_outputs); bt_ctf_validation_output_put_types(&trace_sc_validation_output); BT_PUT(clock_to_add_to_trace); + bt_put(current_parent_trace); assert(!packet_header_type); assert(!packet_context_type); assert(!event_header_type);