From: Jérémie Galarneau Date: Mon, 30 May 2016 06:31:18 +0000 (-0400) Subject: Fix: unchecked return value of bt_ctf_field_type_variant_get_field X-Git-Tag: v2.0.0-pre1~941 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=8f3a93d910ed034a084821a290462a24bc67951a Fix: unchecked return value of bt_ctf_field_type_variant_get_field Reported by Coverity as: CID 1351741 (#1 of 1): Unchecked return value (CHECKED_RETURN) Signed-off-by: Jérémie Galarneau --- 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; }