all repos — mgba @ e443b61c21ca6bda3dc36edc46e851c1352f3e89

mGBA Game Boy Advance Emulator

VFS: Fix resource leaks if some allocations fail
Jeffrey Pfau jeffrey@endrift.com
Wed, 22 Apr 2015 22:08:09 -0700
commit

e443b61c21ca6bda3dc36edc46e851c1352f3e89

parent

2594015853b4a3fb276dec5dd80f4ccc5d2bc566

3 files changed, 4 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -20,6 +20,7 @@ - Qt: Fix controllers sometimes not loading the right profile

- GBA: Fix hang when loading a savestate if sync to video is enabled - Debugger: Fix use-after-free in breakpoint clearing code - Util: Fix resource leak in UTF-8 handling code + - VFS: Fix resource leaks if some allocations fail Misc: - Qt: Show multiplayer numbers in window title - Qt: Solar sensor can have shortcuts set
M src/util/vfs.csrc/util/vfs.c

@@ -197,6 +197,7 @@ }

struct VDirDE* vd = malloc(sizeof(struct VDirDE)); if (!vd) { + closedir(de); return 0; }
M src/util/vfs/vfs-lzma.csrc/util/vfs/vfs-lzma.c

@@ -65,11 +65,11 @@

static const char* _vde7zName(struct VDirEntry* vde); struct VDir* VDirOpen7z(const char* path, int flags) { - struct VDir7z* vd = malloc(sizeof(struct VDir7z)); - if (flags & O_WRONLY || flags & O_CREAT) { return 0; } + + struct VDir7z* vd = malloc(sizeof(struct VDir7z)); // What does any of this mean, Igor? if (InFile_Open(&vd->archiveStream.file, path)) {