Skip to content

Commit 3a23406

Browse files
committed
Don't try to allocate 0 bytes in CStruct REPR.
1 parent e49a91d commit 3a23406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/6model/reprs/CStruct.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
340340

341341
/* Allocate object body. */
342342
CStructBody *body = (CStructBody *)data;
343-
body->cstruct = mem_sys_allocate(repr_data->struct_size);
343+
body->cstruct = mem_sys_allocate(repr_data->struct_size > 0 ? repr_data->struct_size : 1);
344344
memset(body->cstruct, 0, repr_data->struct_size);
345345

346346
/* Initialize the slots. */

0 commit comments

Comments
 (0)