Fix: unchecked return value of bt_ctf_field_type_get_field_at_index
[babeltrace.git] / lib / ctf-ir / field-types.c
index 485c5e8f3ea71e2f68d6b84f62559af01c5a57e2..06d8c76717571d136e5d9e3a9d529125e6d5b830 100644 (file)
@@ -5284,9 +5284,15 @@ struct bt_ctf_field_type *bt_ctf_field_type_get_field_at_index(
 
        switch (type_id) {
        case CTF_TYPE_STRUCT:
-               bt_ctf_field_type_structure_get_field_by_index(field_type,
-                       NULL, &field, index);
+       {
+               int ret = bt_ctf_field_type_structure_get_field_by_index(
+                       field_type, NULL, &field, index);
+               if (ret) {
+                       field = NULL;
+                       goto end;
+               }
                break;
+       }
        case CTF_TYPE_VARIANT:
        {
                int ret = bt_ctf_field_type_variant_get_field_by_index(
This page took 0.023484 seconds and 4 git commands to generate.