/* Optional field, so it can fail silently. */
field = bt_ctf_event_get_stream_event_context(event);
- copy_field = bt_ctf_field_copy(field);
- if (copy_field) {
+ if (field) {
+ copy_field = bt_ctf_field_copy(field);
+ if (!copy_field) {
+ fprintf(err, "[error] %s in %s:%d\n", __func__,
+ __FILE__, __LINE__);
+ goto error;
+ }
ret = bt_ctf_event_set_stream_event_context(writer_event,
copy_field);
if (ret < 0) {
__FILE__, __LINE__);
goto error;
}
+ BT_PUT(field);
+ BT_PUT(copy_field);
}
- BT_PUT(field);
- BT_PUT(copy_field);
/* Optional field, so it can fail silently. */
field = bt_ctf_event_get_event_context(event);
- copy_field = bt_ctf_field_copy(field);
- if (copy_field) {
+ if (field) {
+ copy_field = bt_ctf_field_copy(field);
+ if (!copy_field) {
+ fprintf(err, "[error] %s in %s:%d\n", __func__,
+ __FILE__, __LINE__);
+ goto error;
+ }
ret = bt_ctf_event_set_event_context(writer_event, copy_field);
if (ret < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
goto error;
}
+ BT_PUT(field);
+ BT_PUT(copy_field);
}
- BT_PUT(field);
- BT_PUT(copy_field);
field = bt_ctf_event_get_event_payload(event);
- if (!field) {
- fprintf(err, "[error] %s in %s:%d\n", __func__,
- __FILE__, __LINE__);
- goto error;
- }
- copy_field = bt_ctf_field_copy(field);
- if (copy_field) {
+ if (field) {
+ copy_field = bt_ctf_field_copy(field);
+ if (!copy_field) {
+ fprintf(err, "[error] %s in %s:%d\n", __func__,
+ __FILE__, __LINE__);
+ goto error;
+ }
ret = bt_ctf_event_set_event_payload(writer_event, copy_field);
if (ret < 0) {
fprintf(err, "[error] %s in %s:%d\n", __func__,
__FILE__, __LINE__);
goto error;
}
+ BT_PUT(field);
+ BT_PUT(copy_field);
}
- BT_PUT(field);
- BT_PUT(copy_field);
goto end;