GBA: Fix filehandle leak with savegames

This commit is contained in:
Jeffrey Pfau 2016-08-28 01:44:27 -07:00
parent 28c896eb9f
commit d708a1025d
3 changed files with 8 additions and 0 deletions

View File

@ -34,6 +34,7 @@ Bugfixes:
- VFS: Fix uninitialized varaible reading from 7z
- GBA: Fix losing IRQs when CPSR I bit isn't cleared
- VFS: Fix reading multiple files from a 7z archive
- GBA: Fix filehandle leak with savegames
Misc:
- 3DS: Use blip_add_delta_fast for a small speed improvement
- OpenGL: Log shader compilation failure

View File

@ -12,6 +12,7 @@
#include "gba/hle-bios.h"
#include "util/math.h"
#include "util/memory.h"
#include "util/vfs.h"
#define IDLE_LOOP_THRESHOLD 10000
@ -92,6 +93,9 @@ void GBAMemoryDeinit(struct GBA* gba) {
mappedMemoryFree(gba->memory.rom, gba->memory.romSize);
}
GBASavedataDeinit(&gba->memory.savedata);
if (gba->memory.savedata.realVf) {
gba->memory.savedata.realVf->close(gba->memory.savedata.realVf);
}
}
void GBAMemoryReset(struct GBA* gba) {

View File

@ -47,6 +47,9 @@ void GBASavedataDeinit(struct GBASavedata* savedata) {
if (savedata->vf) {
size_t size = GBASavedataSize(savedata);
savedata->vf->unmap(savedata->vf, savedata->data, size);
if (savedata->vf != savedata->realVf) {
savedata->vf->close(savedata->vf);
}
savedata->vf = 0;
} else {
switch (savedata->type) {