GBA: Fix filehandle leak with savegames
Jeffrey Pfau jeffrey@endrift.com
Sun, 28 Aug 2016 01:44:27 -0700
3 files changed,
8 insertions(+),
0 deletions(-)
M
CHANGES
→
CHANGES
@@ -34,6 +34,7 @@ - Wii: Fix garbage flash at startup
- 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
M
src/gba/memory.c
→
src/gba/memory.c
@@ -12,6 +12,7 @@ #include "gba/serialize.h"
#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 @@ if (gba->memory.rom) {
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) {
M
src/gba/savedata.c
→
src/gba/savedata.c
@@ -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) {