mirror of https://github.com/mgba-emu/mgba.git
VFS: Fix resource leaks if some allocations fail
This commit is contained in:
parent
9552512329
commit
a2e1cd615c
1
CHANGES
1
CHANGES
|
@ -36,6 +36,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: Handle saving input settings better
|
||||
|
|
|
@ -36,6 +36,7 @@ struct VDir* VDirOpen(const char* path) {
|
|||
|
||||
struct VDirDE* vd = malloc(sizeof(struct VDirDE));
|
||||
if (!vd) {
|
||||
closedir(de);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue