From: Jérémie Galarneau Date: Wed, 13 May 2015 16:04:35 +0000 (-0400) Subject: Tests: fix possible null pointer dereference X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=0fae838ff026d62e84badfc8f50ce0427b8135e0;p=deliverable%2Fbabeltrace.git Tests: fix possible null pointer dereference 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 --- diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index d1a61eaa1..60a51132f 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,