[Scummvm-git-logs] scummvm master -> 15916e02f1fd5bb80dc40f43e3e720106a35ce75

eriktorbjorn eriktorbjorn at telia.com
Mon Sep 6 06:38:34 UTC 2021


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:
15916e02f1 COMMON: Fix Valgrind warning in PEResources


Commit: 15916e02f1fd5bb80dc40f43e3e720106a35ce75
    https://github.com/scummvm/scummvm/commit/15916e02f1fd5bb80dc40f43e3e720106a35ce75
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2021-09-06T08:37:25+02:00

Commit Message:
COMMON: Fix Valgrind warning in PEResources

As with NEResources, _disposeFileHandle was never set.

Changed paths:
    common/winexe_pe.cpp


diff --git a/common/winexe_pe.cpp b/common/winexe_pe.cpp
index 48989694de..13a8159830 100644
--- a/common/winexe_pe.cpp
+++ b/common/winexe_pe.cpp
@@ -40,9 +40,11 @@ PEResources::~PEResources() {
 void PEResources::clear() {
 	_sections.clear();
 	_resources.clear();
-	if (_disposeFileHandle == DisposeAfterUse::YES)
-		delete _exe;
-	_exe = nullptr;
+	if (_exe) {
+		if (_disposeFileHandle == DisposeAfterUse::YES)
+			delete _exe;
+		_exe = nullptr;
+	}
 }
 
 bool PEResources::loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag disposeFileHandle) {
@@ -95,6 +97,7 @@ bool PEResources::loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag
 	}
 
 	_exe = stream;
+	_disposeFileHandle = disposeFileHandle;
 
 	Section &resSection = _sections[".rsrc"];
 	parseResourceLevel(resSection, resSection.offset, 0);




More information about the Scummvm-git-logs mailing list