From 92a2519846d537d6a75c09f239c1ebf5118a4e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Mon, 6 Sep 2021 08:01:08 +0200 Subject: [PATCH] COMMON: Fix _disposeFileHandle not being set If there is a file handle, the clear() method checks if it should be disposed of. However, the _disposeFileHandle variable was never set, so it's unlikely that _exe was ever deleted. I found this out from a Valgrind warning when quitting Buried in Time. This seems like a very obvious fix to me, and as such it seems like a good candidate for backporting to the release branch. On the other hand, maybe there are cases where it worked by sheer, dumb luck? I'm not familiar enough with where and how it is used. --- common/winexe_ne.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/common/winexe_ne.cpp b/common/winexe_ne.cpp index c81b16c76ec..0f5ec73c265 100644 --- a/common/winexe_ne.cpp +++ b/common/winexe_ne.cpp @@ -52,6 +52,7 @@ bool NEResources::loadFromEXE(SeekableReadStream *stream, DisposeAfterUse::Flag return false; _exe = stream; + _disposeFileHandle = disposeFileHandle; uint32 offsetResourceTable = getResourceTableOffset(); if (offsetResourceTable == 0xFFFFFFFF)