From aea7d97bb5ab594d46a521d4507100cd3f4bee9d Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Tue, 31 Mar 2026 21:11:19 +0200 Subject: [PATCH] Fix heap corruption caused by JKRExpHeap::do_freeAll Caused by a size that should've been sizeof(CMemBlock). Simple way to repro was to open and close the full map on dpad, afterwards heap check would fail. --- libs/JSystem/src/JKernel/JKRExpHeap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/JSystem/src/JKernel/JKRExpHeap.cpp b/libs/JSystem/src/JKernel/JKRExpHeap.cpp index 3ec15cd161..fbcde13113 100644 --- a/libs/JSystem/src/JKernel/JKRExpHeap.cpp +++ b/libs/JSystem/src/JKernel/JKRExpHeap.cpp @@ -472,7 +472,7 @@ void JKRExpHeap::do_freeAll() { JKRHeap::callAllDisposer(); mHeadFreeList = (CMemBlock*)mStart; mTailFreeList = mHeadFreeList; - mHeadFreeList->initiate(NULL, NULL, mSize - 0x10, 0, 0); + mHeadFreeList->initiate(NULL, NULL, mSize - sizeof(CMemBlock), 0, 0); mHeadUsedList = NULL; mTailUsedList = NULL; #if DEBUG