From aa172aad6ca9b48b1050d08611397a23e941a111 Mon Sep 17 00:00:00 2001 From: FosterProgramming Date: Mon, 8 Dec 2025 22:56:51 +0100 Subject: [PATCH] Free the allocated buffer before the second decompression call (hopefully helps) (#8301) --- src/battle_anim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_anim.c b/src/battle_anim.c index cf1f32ed85..0e17819213 100644 --- a/src/battle_anim.c +++ b/src/battle_anim.c @@ -1575,9 +1575,9 @@ void LoadMoveBg(u16 bgId) void *decompressionBuffer = malloc_and_decompress(gBattleAnimBackgroundTable[bgId].tilemap, NULL); RelocateBattleBgPal(GetBattleBgPaletteNum(), decompressionBuffer, 0x100, FALSE); DmaCopy32(3, decompressionBuffer, (void *)BG_SCREEN_ADDR(26), 0x800); + Free(decompressionBuffer); DecompressDataWithHeaderVram(gBattleAnimBackgroundTable[bgId].image, (void *)BG_SCREEN_ADDR(4)); LoadPalette(gBattleAnimBackgroundTable[bgId].palette, BG_PLTT_ID(GetBattleBgPaletteNum()), PLTT_SIZE_4BPP); - Free(decompressionBuffer); } else {