ir: bt_ctf_stream_append_event(): do not always reset parent
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 24 Feb 2016 00:24:59 +0000 (19:24 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 24 Feb 2016 20:27:32 +0000 (15:27 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/stream.c

index 04bd0dfeba207fff347d0b765cc06eab6cf270c7..56abfcea5f89fe1f78f47241428fcc20d3688361 100644 (file)
@@ -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;
 }
 
This page took 0.026068 seconds and 4 git commands to generate.