Skip to content

Commit a5574a3

Browse files
Use calloc instead of malloc when initializing backgrounds to fix segfaults when trying to free gms2TileIds on non-GM:S2 games
1 parent 9b90b12 commit a5574a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/data_win.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ static void parseBGND(BinaryReader* reader, DataWin* dw) {
576576

577577
if (count == 0) { free(ptrs); b->backgrounds = nullptr; return; }
578578

579-
b->backgrounds = safeMalloc(count * sizeof(Background));
579+
b->backgrounds = safeCalloc(count, sizeof(Background));
580580
repeat(count, i) {
581581
BinaryReader_seek(reader, ptrs[i]);
582582
Background* bg = &b->backgrounds[i];

0 commit comments

Comments
 (0)