Parse CTF indexes
[babeltrace.git] / formats / ctf / writer / event-fields.c
index 30fe5783db6e86a696b9ef96321ef9f233a7767b..ad4fcb5a06c1ed5d3ad4e5636fdfab603f832623 100644 (file)
@@ -179,8 +179,8 @@ struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
        }
 
        type_id = bt_ctf_field_type_get_type_id(type);
-       if (type_id <= CTF_TYPE_UNKNOWN ||
-               type_id >= NR_CTF_TYPES) {
+       if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES ||
+               bt_ctf_field_type_validate(type)) {
                goto error;
        }
 
@@ -1125,7 +1125,10 @@ int bt_ctf_field_structure_serialize(struct bt_ctf_field *field,
        while (!ctf_pos_access_ok(pos,
                offset_align(pos->offset,
                        field->type->declaration->alignment))) {
-               increase_packet_size(pos);
+               ret = increase_packet_size(pos);
+               if (ret) {
+                       goto end;
+               }
        }
 
        ctf_align_pos(pos, field->type->declaration->alignment);
@@ -1139,7 +1142,7 @@ int bt_ctf_field_structure_serialize(struct bt_ctf_field *field,
                        break;
                }
        }
-
+end:
        return ret;
 }
 
This page took 0.030649 seconds and 4 git commands to generate.