VFS: Fix resource leaks if some allocations fail
Jeffrey Pfau jeffrey@endrift.com
Wed, 22 Apr 2015 22:08:09 -0700
3 files changed,
4 insertions(+),
2 deletions(-)
M
CHANGES
→
CHANGES
@@ -36,6 +36,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: Handle saving input settings better
M
src/util/vfs/vfs-dirent.c
→
src/util/vfs/vfs-dirent.c
@@ -36,6 +36,7 @@ }
struct VDirDE* vd = malloc(sizeof(struct VDirDE)); if (!vd) { + closedir(de); return 0; }
M
src/util/vfs/vfs-lzma.c
→
src/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)) {