thunk.c:91:32: warning: Call to 'malloc' has an allocation size of 0 bytes
se->field_offsets[i] = malloc(nb_fields * sizeof(int));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reported-by: Clang Static Analyzer
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
int nb_fields, offset, max_align, align, size, i, j;
assert(id < max_struct_entries);
- se = struct_entries + id;
/* first we count the number of fields */
type_ptr = types;
type_ptr = thunk_type_next(type_ptr);
nb_fields++;
}
+ assert(nb_fields > 0);
+ se = struct_entries + id;
se->field_types = types;
se->nb_fields = nb_fields;
se->name = name;