mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +00:00
- fixed: FResourceFile::OpenResourceFile did not close the opened file in case it contained invalid data.
This commit is contained in:
parent
06ad2351d3
commit
aaae52c60b
1 changed files with 3 additions and 0 deletions
|
@ -291,11 +291,13 @@ static CheckFunc funcs[] = { CheckWad, CheckZip, Check7Z, CheckPak, CheckGRP, Ch
|
|||
|
||||
FResourceFile *FResourceFile::OpenResourceFile(const char *filename, FileReader *file, bool quiet, bool containeronly)
|
||||
{
|
||||
bool mustclose = false;
|
||||
if (file == NULL)
|
||||
{
|
||||
try
|
||||
{
|
||||
file = new FileReader(filename);
|
||||
mustclose = true;
|
||||
}
|
||||
catch (CRecoverableError &)
|
||||
{
|
||||
|
@ -307,6 +309,7 @@ FResourceFile *FResourceFile::OpenResourceFile(const char *filename, FileReader
|
|||
FResourceFile *resfile = funcs[i](filename, file, quiet);
|
||||
if (resfile != NULL) return resfile;
|
||||
}
|
||||
if (mustclose) delete file;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue