mirror of https://github.com/mgba-emu/mgba.git
GBA: Fix leak if attempting to load BIOS multiple times
This commit is contained in:
parent
a59ccd2d24
commit
aa9a8d1430
1
CHANGES
1
CHANGES
|
@ -15,6 +15,7 @@ Other fixes:
|
|||
- All: Correct more format strings on Windows (fixes mgba.io/i/1817)
|
||||
- CMake: Fix build with libzip 1.7
|
||||
- GB Core: Fix extracting SRAM when none is present
|
||||
- GBA: Fix leak if attempting to load BIOS multiple times
|
||||
- GBA Savedata: Fix extracting save when not yet configured in-game
|
||||
- Qt: Fix file handle leak on opening an invalid ROM
|
||||
- Qt: Fix Italian RTC translation (fixes mgba.io/i/1798)
|
||||
|
|
|
@ -444,7 +444,6 @@ void GBAYankROM(struct GBA* gba) {
|
|||
}
|
||||
|
||||
void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
|
||||
gba->biosVf = vf;
|
||||
if (vf->size(vf) != SIZE_BIOS) {
|
||||
mLOG(GBA, WARN, "Incorrect BIOS size");
|
||||
return;
|
||||
|
@ -454,6 +453,11 @@ void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
|
|||
mLOG(GBA, WARN, "Couldn't map BIOS");
|
||||
return;
|
||||
}
|
||||
if (gba->biosVf) {
|
||||
gba->biosVf->unmap(gba->biosVf, gba->memory.bios, SIZE_BIOS);
|
||||
gba->biosVf->close(gba->biosVf);
|
||||
}
|
||||
gba->biosVf = vf;
|
||||
gba->memory.bios = bios;
|
||||
gba->memory.fullBios = 1;
|
||||
uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
|
||||
|
|
Loading…
Reference in New Issue