When alloc size is too large, only allocate struct

This commit is contained in:
Matt Valentine-House 2023-06-12 13:13:32 +01:00 committed by Jean Boussier
parent 31e24a42f3
commit 6fe46ff967
Notes: git 2023-06-12 14:20:25 +00:00
2 changed files with 9 additions and 1 deletions

View file

@ -849,7 +849,7 @@ struct_alloc(VALUE klass)
return (VALUE)st;
}
else {
NEWOBJ_OF(st, struct RStruct, klass, flags, embedded_size, 0);
NEWOBJ_OF(st, struct RStruct, klass, flags, sizeof(struct RStruct), 0);
st->as.heap.ptr = struct_heap_alloc((VALUE)st, n);
rb_mem_clear((VALUE *)st->as.heap.ptr, n);