From cfb74f3de463dfeffacda5313d75d6055f635e0e Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Wed, 14 Jun 2017 14:23:43 -0400 Subject: [PATCH] copytrace: packet_context is optional MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- plugins/libctfcopytrace/ctfcopytrace.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 5c78d6f8..b50783cc 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -398,20 +398,16 @@ struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, } type = bt_ctf_stream_class_get_packet_context_type(stream_class); - if (!type) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, - __LINE__); - goto error; - } - - ret_int = bt_ctf_stream_class_set_packet_context_type( - writer_stream_class, type); - if (ret_int < 0) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, - __LINE__); - goto error; + if (type) { + ret_int = bt_ctf_stream_class_set_packet_context_type( + writer_stream_class, type); + if (ret_int < 0) { + fprintf(err, "[error] %s in %s:%d\n", __func__, + __FILE__, __LINE__); + goto error; + } + BT_PUT(type); } - BT_PUT(type); type = bt_ctf_stream_class_get_event_header_type(stream_class); if (!type) { -- 2.34.1