From: Jérémie Galarneau Date: Mon, 25 May 2015 20:08:26 +0000 (-0400) Subject: Fix: bt_ctf_trace_freeze must fail if type resolving fails X-Git-Tag: v2.0.0-pre1~1228 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=7dab6d2d22f6cae426472048087ac834682d52e9 Fix: bt_ctf_trace_freeze must fail if type resolving fails Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/trace.c b/formats/ctf/ir/trace.c index b8f4f725..32de5bb5 100644 --- a/formats/ctf/ir/trace.c +++ b/formats/ctf/ir/trace.c @@ -46,7 +46,7 @@ void bt_ctf_trace_destroy(struct bt_ctf_ref *ref); static int init_trace_packet_header(struct bt_ctf_trace *trace); static -void bt_ctf_trace_freeze(struct bt_ctf_trace *trace); +int bt_ctf_trace_freeze(struct bt_ctf_trace *trace); static const unsigned int field_type_aliases_alignments[] = { @@ -504,7 +504,8 @@ int bt_ctf_trace_add_stream_class(struct bt_ctf_trace *trace, bt_ctf_stream_class_freeze(stream_class); if (!trace->frozen) { - bt_ctf_trace_freeze(trace); + ret = bt_ctf_trace_freeze(trace); + goto end; } end: if (ret) { @@ -892,11 +893,19 @@ struct bt_ctf_field_type *get_field_type(enum field_type_alias alias) } static -void bt_ctf_trace_freeze(struct bt_ctf_trace *trace) +int bt_ctf_trace_freeze(struct bt_ctf_trace *trace) { - bt_ctf_trace_resolve_types(trace); + int ret = 0; + + ret = bt_ctf_trace_resolve_types(trace); + if (ret) { + goto end; + } + bt_ctf_attributes_freeze(trace->environment); trace->frozen = 1; +end: + return ret; } static