[Scummvm-git-logs] scummvm master -> 1daa27ed4f910ded605ca85151b4843cec32f992

sev- sev at scummvm.org
Thu May 7 08:20:10 UTC 2020


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:
1daa27ed4f DIRECTOR: Fix memory management in RIFXArchie


Commit: 1daa27ed4f910ded605ca85151b4843cec32f992
    https://github.com/scummvm/scummvm/commit/1daa27ed4f910ded605ca85151b4843cec32f992
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-07T10:19:35+02:00

Commit Message:
DIRECTOR: Fix memory management in RIFXArchie

Changed paths:
    engines/director/archive.cpp


diff --git a/engines/director/archive.cpp b/engines/director/archive.cpp
index aeea74ccb0..b6b1565385 100644
--- a/engines/director/archive.cpp
+++ b/engines/director/archive.cpp
@@ -424,7 +424,7 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
 	subStream.readUint32(); // unknown
 
 	Common::Array<Resource> resources;
-	resources.reserve(2048);
+	resources.reserve(resCount);
 
 	// Need to look for these two resources
 	const Resource *keyRes = 0;
@@ -453,9 +453,9 @@ bool RIFXArchive::openStream(Common::SeekableReadStream *stream, uint32 startOff
 
 		// Looking for two types here
 		if (tag == MKTAG('K', 'E', 'Y', '*'))
-			keyRes = &resources[resources.size() - 1];
+			keyRes = &resources.back();
 		else if (tag == MKTAG('C', 'A', 'S', '*'))
-			casRes = &resources[resources.size() - 1];
+			casRes = &resources.back();
 		// or the children of
 		else if (tag == MKTAG('S', 'T', 'X', 'T') ||
 				 tag == MKTAG('B', 'I', 'T', 'D') ||




More information about the Scummvm-git-logs mailing list