mirror of https://github.com/mgba-emu/mgba.git
VFS: Fix file handle leak in 7z
This commit is contained in:
parent
e9436e43db
commit
97b82ae6cd
|
@ -95,6 +95,7 @@ struct VDir* VDirOpen7z(const char* path, int flags) {
|
|||
SzArEx_Init(&vd->db);
|
||||
SRes res = SzArEx_Open(&vd->db, &vd->lookStream.s, &vd->allocImp, &vd->allocTempImp);
|
||||
if (res != SZ_OK) {
|
||||
File_Close(&vd->archiveStream.file);
|
||||
free(vd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -115,6 +116,7 @@ struct VDir* VDirOpen7z(const char* path, int flags) {
|
|||
bool _vf7zClose(struct VFile* vf) {
|
||||
struct VFile7z* vf7z = (struct VFile7z*) vf;
|
||||
IAlloc_Free(&vf7z->vd->allocImp, vf7z->outBuffer);
|
||||
File_Close(&vf7z->vd->archiveStream.file);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue