X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fir%2Ftrace.c;fp=formats%2Fctf%2Fir%2Ftrace.c;h=dfb815514f55a145fa2c10ea2a3c7f3c090a4079;hb=835b2d10c5c80ebad6427ba3794d712dd44ef145;hp=ee50df6dc8e9d8714b8397781283274c184e29b0;hpb=9531634fc191fc3b0c3f9f0a840f95396914ba66;p=babeltrace.git diff --git a/formats/ctf/ir/trace.c b/formats/ctf/ir/trace.c index ee50df6d..dfb81551 100644 --- a/formats/ctf/ir/trace.c +++ b/formats/ctf/ir/trace.c @@ -1073,21 +1073,21 @@ int bt_ctf_trace_set_packet_header_type(struct bt_ctf_trace *trace, { int ret = 0; - if (!trace || !packet_header_type || trace->frozen) { + if (!trace || trace->frozen) { ret = -1; goto end; } - /* packet_header_type must be a structure */ - if (bt_ctf_field_type_get_type_id(packet_header_type) != - BT_CTF_TYPE_ID_STRUCT) { + /* packet_header_type must be a structure. */ + if (packet_header_type && + bt_ctf_field_type_get_type_id(packet_header_type) != + BT_CTF_TYPE_ID_STRUCT) { ret = -1; goto end; } - bt_get(packet_header_type); bt_put(trace->packet_header_type); - trace->packet_header_type = packet_header_type; + trace->packet_header_type = bt_get(packet_header_type); end: return ret; }