From 0fae838ff026d62e84badfc8f50ce0427b8135e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 13 May 2015 12:04:35 -0400 Subject: [PATCH] Tests: fix possible null pointer dereference MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Coverity Scan *** CID 1297896: Null pointer dereferences (NULL_RETURNS) /tests/lib/test_ctf_writer.c: 865 in append_complex_event() Signed-off-by: Jérémie Galarneau --- tests/lib/test_ctf_writer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index d1a61eaa..60a51132 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -862,7 +862,7 @@ void append_complex_event(struct bt_ctf_stream_class *stream_class, ok(bt_ctf_field_type_variant_get_tag_name(NULL) == NULL, "bt_ctf_field_type_variant_get_tag_name handles NULL correctly"); ret_string = bt_ctf_field_type_variant_get_tag_name(variant_type); - ok(!strcmp(ret_string, "variant_selector"), + ok(ret_string ? !strcmp(ret_string, "variant_selector") : 0, "bt_ctf_field_type_variant_get_tag_name returns the correct variant tag name"); ok(bt_ctf_field_type_variant_get_field_type_by_name(NULL, "INT16_TYPE") == NULL, -- 2.34.1