GB: Properly unmap ROM base when unloading ROM
Vicki Pfau vi@endrift.com
Mon, 22 Mar 2021 23:48:19 -0700
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
src/gb/gb.c
→
src/gb/gb.c
@@ -293,6 +293,10 @@ }
void GBUnloadROM(struct GB* gb) { // TODO: Share with GBAUnloadROM + off_t romBase = gb->memory.romBase - gb->memory.rom; + if (romBase >= 0 && ((size_t) romBase < gb->memory.romSize || (size_t) romBase < gb->yankedRomSize)) { + gb->memory.romBase = NULL; + } if (gb->memory.rom && !gb->isPristine) { if (gb->yankedRomSize) { gb->yankedRomSize = 0;