From 8f3a93d910ed034a084821a290462a24bc67951a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Mon, 30 May 2016 02:31:18 -0400 Subject: [PATCH] Fix: unchecked return value of bt_ctf_field_type_variant_get_field MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported by Coverity as: CID 1351741 (#1 of 1): Unchecked return value (CHECKED_RETURN) Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/field-types.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/formats/ctf/ir/field-types.c b/formats/ctf/ir/field-types.c index c0c396ff..f898d5af 100644 --- a/formats/ctf/ir/field-types.c +++ b/formats/ctf/ir/field-types.c @@ -4063,9 +4063,15 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( index); break; case CTF_TYPE_VARIANT: - bt_ctf_field_type_variant_get_field(field_type, NULL, + { + int ret = bt_ctf_field_type_variant_get_field(field_type, NULL, &field, index); + if (ret) { + field = NULL; + goto end; + } break; + } case CTF_TYPE_ARRAY: field = bt_ctf_field_type_array_get_element_type(field_type); break; @@ -4075,7 +4081,7 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index( default: break; } - +end: return field; } -- 2.34.1