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
5b319cfd91
commit
39203a0daf
1
CHANGES
1
CHANGES
|
@ -39,6 +39,7 @@ Other fixes:
|
||||||
- FFmpeg: Fix some small memory leaks
|
- FFmpeg: Fix some small memory leaks
|
||||||
- FFmpeg: Fix encoding of time base
|
- FFmpeg: Fix encoding of time base
|
||||||
- GB Core: Fix extracting SRAM when none is present
|
- 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
|
- GBA Savedata: Fix extracting save when not yet configured in-game
|
||||||
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
|
||||||
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)
|
||||||
|
|
|
@ -443,7 +443,6 @@ void GBAYankROM(struct GBA* gba) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
|
void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
|
||||||
gba->biosVf = vf;
|
|
||||||
if (vf->size(vf) != SIZE_BIOS) {
|
if (vf->size(vf) != SIZE_BIOS) {
|
||||||
mLOG(GBA, WARN, "Incorrect BIOS size");
|
mLOG(GBA, WARN, "Incorrect BIOS size");
|
||||||
return;
|
return;
|
||||||
|
@ -453,6 +452,11 @@ void GBALoadBIOS(struct GBA* gba, struct VFile* vf) {
|
||||||
mLOG(GBA, WARN, "Couldn't map BIOS");
|
mLOG(GBA, WARN, "Couldn't map BIOS");
|
||||||
return;
|
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.bios = bios;
|
||||||
gba->memory.fullBios = 1;
|
gba->memory.fullBios = 1;
|
||||||
uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
|
uint32_t checksum = GBAChecksum(gba->memory.bios, SIZE_BIOS);
|
||||||
|
|
Loading…
Reference in New Issue