mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-30 12:50:51 +00:00
COMMON: Fix memory leak when invalid PE executable is loaded
In function `PEResources::loadFromEXE`, there were memory leaks because of not properly handling with streams, and thus when the loaded movie was bad/non-exe file, the memory was not freed. This was undetected in normal exe loading because there the streams were being assigned and closed properly.
This commit is contained in:
parent
2c570f27e5
commit
7d8dcebeb7
@ -49,6 +49,9 @@ void PEResources::clear() {
|
||||
bool PEResources::loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle) {
|
||||
clear();
|
||||
|
||||
_exe = stream;
|
||||
_disposeFileHandle = disposeFileHandle;
|
||||
|
||||
if (!stream)
|
||||
return false;
|
||||
|
||||
@ -95,9 +98,6 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag
|
||||
return false;
|
||||
}
|
||||
|
||||
_exe = stream;
|
||||
_disposeFileHandle = disposeFileHandle;
|
||||
|
||||
Section &resSection = _sections[".rsrc"];
|
||||
parseResourceLevel(resSection, resSection.offset, 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user