harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 88420fa6655d4d5d31949dec435791fb51d94063
parent 3b8f60242c3141e221bd8956096f4082cd6eb97f
Author: Bor Grošelj Simić <bor.groseljsimic@telemach.net>
Date:   Mon, 27 Dec 2021 04:16:34 +0100

struct_init_from_atype: fix segfault on error path

Signed-off-by: Bor Grošelj Simić <bor.groseljsimic@telemach.net>

Diffstat:
Msrc/type_store.c | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/type_store.c b/src/type_store.c @@ -281,6 +281,9 @@ struct_init_from_atype(struct type_store *store, enum type_storage storage, while (atype) { struct struct_field *field = struct_insert_field(store, fields, storage, size, &usize, align, atype, ccompat, size_only); + if (field == NULL) { + return; + } if (!field->name && !size_only) { // We need to shift the embedded struct/union's fields // so that their offsets are from the start of the