VFS: Fix resource leaks if some allocations fail

This commit is contained in:
Jeffrey Pfau 2015-04-22 22:08:09 -07:00
parent 2594015853
commit e443b61c21
3 changed files with 4 additions and 2 deletions

View File

@ -20,6 +20,7 @@ Bugfixes:
- 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

View File

@ -197,6 +197,7 @@ struct VDir* VDirOpen(const char* path) {
struct VDirDE* vd = malloc(sizeof(struct VDirDE));
if (!vd) {
closedir(de);
return 0;
}

View File

@ -65,12 +65,12 @@ static struct VFile* _vd7zOpenFile(struct VDir* vd, const char* path, int mode);
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)) {
free(vd);