X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=formats%2Fctf%2Fir%2Fevent-fields.c;h=e05fd3244bc53749614f3e7698cb423f121058e7;hb=92c8b4f90f1b9c12547623f24b756b4167b4d59a;hp=6220144a2b57bc94d216a73bf1de34f2adbb8388;hpb=2829190c6db1463f7f8b71db147a765ebe6455ed;p=babeltrace.git diff --git a/formats/ctf/ir/event-fields.c b/formats/ctf/ir/event-fields.c index 6220144a..e05fd324 100644 --- a/formats/ctf/ir/event-fields.c +++ b/formats/ctf/ir/event-fields.c @@ -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; }