Fix: ir: incr ref of existing sequence/array field
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 7 Apr 2015 22:10:15 +0000 (18:10 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 28 Apr 2015 19:15:35 +0000 (15:15 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
formats/ctf/ir/event-fields.c

index 6220144a2b57bc94d216a73bf1de34f2adbb8388..e05fd3244bc53749614f3e7698cb423f121058e7 100644 (file)
@@ -524,12 +524,14 @@ struct bt_ctf_field *bt_ctf_field_array_get_field(struct bt_ctf_field *field,
        }
 
        new_field = bt_ctf_field_create(field_type);
-       bt_ctf_field_get(new_field);
        array->elements->pdata[(size_t)index] = new_field;
 end:
        if (field_type) {
                bt_ctf_field_type_put(field_type);
        }
+       if (new_field) {
+               bt_ctf_field_get(new_field);
+       }
        return new_field;
 }
 
@@ -557,12 +559,14 @@ struct bt_ctf_field *bt_ctf_field_sequence_get_field(struct bt_ctf_field *field,
        }
 
        new_field = bt_ctf_field_create(field_type);
-       bt_ctf_field_get(new_field);
        sequence->elements->pdata[(size_t)index] = new_field;
 end:
        if (field_type) {
                bt_ctf_field_type_put(field_type);
        }
+       if (new_field) {
+               bt_ctf_field_get(new_field);
+       }
        return new_field;
 }
 
This page took 0.027924 seconds and 4 git commands to generate.