From: Philippe Proulx Date: Wed, 24 Feb 2016 00:24:59 +0000 (-0500) Subject: ir: bt_ctf_stream_append_event(): do not always reset parent X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=37f301682345ca58a078ba6bcd131fd0030fed0c ir: bt_ctf_stream_append_event(): do not always reset parent Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/formats/ctf/ir/stream.c b/formats/ctf/ir/stream.c index 04bd0dfe..56abfcea 100644 --- a/formats/ctf/ir/stream.c +++ b/formats/ctf/ir/stream.c @@ -582,13 +582,13 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, bt_object_set_parent(event, stream); ret = bt_ctf_event_populate_event_header(event); if (ret) { - goto end; + goto error; } /* Make sure the various scopes of the event are set */ ret = bt_ctf_event_validate(event); if (ret) { - goto end; + goto error; } /* Save the new event and freeze it */ @@ -602,14 +602,17 @@ int bt_ctf_stream_append_event(struct bt_ctf_stream *stream, * longer needed. */ bt_put(event->event_class); + end: - if (ret) { - /* - * Orphan the event; we were not succesful in associating it to - * a stream. - */ - bt_object_set_parent(event, NULL); - } + return ret; + +error: + /* + * Orphan the event; we were not successful in associating it to + * a stream. + */ + bt_object_set_parent(event, NULL); + return ret; }