[Scummvm-git-logs] scummvm master -> 12bb1a495fa5d98ef51a16f3668fd2ab81e7142c

rvanlaar noreply at scummvm.org
Fri Sep 23 23:39:48 UTC 2022


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
dd7a914ff6 DIRECTOR: refactor createArchive
12bb1a495f DIRECTOR: Fix memory leaks D3 win EXE loading


Commit: dd7a914ff67c87731f0c48ed3c61825cfe554c69
    https://github.com/scummvm/scummvm/commit/dd7a914ff67c87731f0c48ed3c61825cfe554c69
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-24T01:39:32+02:00

Commit Message:
DIRECTOR: refactor createArchive

Simplify `createArchive` by checking for version first and platform
second.

Changed paths:
    engines/director/resource.cpp


diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 50c59262228..8b947b93a5b 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -38,17 +38,12 @@
 namespace Director {
 
 Archive *DirectorEngine::createArchive() {
-	if (getPlatform() != Common::kPlatformWindows) {
-		if (getVersion() < 400)
+	if (getVersion() < 400) {
+		if (getPlatform() != Common::kPlatformWindows)
 			return new MacArchive();
-		else
-			return new RIFXArchive();
-	} else {
-		if (getVersion() < 400)
-			return new RIFFArchive();
-		else
-			return new RIFXArchive();
+		return new RIFFArchive();
 	}
+	return new RIFXArchive();
 }
 
 Common::Error Window::loadInitialMovie() {


Commit: 12bb1a495fa5d98ef51a16f3668fd2ab81e7142c
    https://github.com/scummvm/scummvm/commit/12bb1a495fa5d98ef51a16f3668fd2ab81e7142c
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-09-24T01:39:32+02:00

Commit Message:
DIRECTOR: Fix memory leaks D3 win EXE loading

Fixed Archives that were instantiated but not closed.

Changed paths:
    engines/director/resource.cpp


diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp
index 8b947b93a5b..bacfc8f9bf2 100644
--- a/engines/director/resource.cpp
+++ b/engines/director/resource.cpp
@@ -270,6 +270,8 @@ void Window::loadEXE(const Common::String movie) {
 		}
 	}
 
+	delete exeStream;
+
 	if (_mainArchive)
 		_mainArchive->setPathName(movie);
 }
@@ -318,10 +320,12 @@ void Window::loadEXEv3(Common::SeekableReadStream *stream) {
 
 		_mainArchive = new RIFFArchive();
 
-		if (!_mainArchive->openStream(stream, riffOffset))
-			warning("Failed to load RIFF from EXE");
-		else
+		if (_mainArchive->openStream(stream, riffOffset))
 			return;
+
+		warning("Failed to load RIFF from EXE");
+		delete _mainArchive;
+		_mainArchive = nullptr;
 	}
 
 	openMainArchive(mmmFileName);




More information about the Scummvm-git-logs mailing list