[Scummvm-git-logs] scummvm master -> 7d8dcebeb70776a3e388c387541c877ba6675892
sev-
noreply at scummvm.org
Wed Jun 14 11:58:07 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7d8dcebeb7 COMMON: Fix memory leak when invalid PE executable is loaded
Commit: 7d8dcebeb70776a3e388c387541c877ba6675892
https://github.com/scummvm/scummvm/commit/7d8dcebeb70776a3e388c387541c877ba6675892
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-06-14T13:57:50+02:00
Commit Message:
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.
Changed paths:
common/formats/winexe_pe.cpp
diff --git a/common/formats/winexe_pe.cpp b/common/formats/winexe_pe.cpp
index af8ac645ec9..4048b8187a2 100644
--- a/common/formats/winexe_pe.cpp
+++ b/common/formats/winexe_pe.cpp
@@ -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);
More information about the Scummvm-git-logs
mailing list