Remove memory leak in loadzip.cpp

* Call `unzClose(file)` outside of the assert clause. In Release mode,
any statement in an assert clause is not called, causing a memory leak.
If the file does not close successfully, `assert(FAIL)` is called.
This commit is contained in:
Nelson Garcia 2018-11-05 13:23:21 -08:00 committed by Brandon Wright
parent b5b7c4390c
commit 6591ee92a2
1 changed files with 2 additions and 1 deletions

View File

@ -257,7 +257,8 @@ bool8 LoadZip (const char *zipname, uint32 *TotalFileSize, uint8 *buffer)
if (!(port == UNZ_END_OF_LIST_OF_FILE || port == UNZ_OK) || filesize == 0 ||
(len > 5 && strcasecmp(zipname + len - 5, ".msu1") == 0 && strcasecmp(filename, "program.rom") != 0))
{
assert(unzClose(file) == UNZ_OK);
if (unzClose(file) != UNZ_OK)
assert(FALSE);
return (FALSE);
}