From 37f301682345ca58a078ba6bcd131fd0030fed0c Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 23 Feb 2016 19:24:59 -0500 Subject: [PATCH] ir: bt_ctf_stream_append_event(): do not always reset parent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/stream.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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; } -- 2.34.1