[Scummvm-git-logs] scummvm branch-2-9 -> ac994e599acf130539bc997920381a01b3968795

dwatteau noreply at scummvm.org
Tue Apr 29 12:24:08 UTC 2025


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

Summary:
f93f8d4ac0 COMMON: Fix memory leak on zlib error
81b5b83ab3 AVALANCHE: Fix memory leak in ghostDrawBackgroundItems
3353d492b3 COMMON: Fix memory leak in Cel3DODecoder
0f8d586241 NGI: Fix memory leaks
fe9df09d1b ZVISION: Fix memory leak
dc90cd306e IMMORTAL: Fix memory leaks when decompressing
94afac6a11 BACKENDS: MACOS: Print a warning when no files are found in CDDAFS volumes
ac994e599a BACKENDS: FS: Work around broken `d_type` values for cddafs in macOS < 10.6.2


Commit: f93f8d4ac09ac56b9fc2029340d04cb5348a58e1
    https://github.com/scummvm/scummvm/commit/f93f8d4ac09ac56b9fc2029340d04cb5348a58e1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
COMMON: Fix memory leak on zlib error

CID 1591742

(cherry picked from commit 88c6586c1486ab45ebb1db89952cf2a0d783d5b6)

Changed paths:
    common/compression/zlib.cpp
    devtools/create_titanic/zlib.cpp


diff --git a/common/compression/zlib.cpp b/common/compression/zlib.cpp
index f52e3f3984d..c0e0efd053a 100644
--- a/common/compression/zlib.cpp
+++ b/common/compression/zlib.cpp
@@ -68,8 +68,10 @@ bool inflateZlibHeaderless(byte *dst, uint *dstLen, const byte *src, uint srcLen
 	// Set the dictionary, if provided
 	if (dict != nullptr) {
 		err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen);
-		if (err != Z_OK)
+		if (err != Z_OK) {
+			inflateEnd(&stream);
 			return false;
+		}
 	}
 
 	err = inflate(&stream, Z_SYNC_FLUSH);
diff --git a/devtools/create_titanic/zlib.cpp b/devtools/create_titanic/zlib.cpp
index 0d2645b443d..0712aa7d6fd 100644
--- a/devtools/create_titanic/zlib.cpp
+++ b/devtools/create_titanic/zlib.cpp
@@ -80,8 +80,10 @@ bool inflateZlibHeaderless(byte *dst, uint dstLen, const byte *src, uint srcLen,
 	// Set the dictionary, if provided
 	if (dict != nullptr) {
 		err = inflateSetDictionary(&stream, const_cast<byte *>(dict), dictLen);
-		if (err != Z_OK)
+		if (err != Z_OK) {
+			inflateEnd(&stream);
 			return false;
+		}
 	}
 
 	err = inflate(&stream, Z_SYNC_FLUSH);


Commit: 81b5b83ab3bf5377012c3c1b0b68fb4d8923e14b
    https://github.com/scummvm/scummvm/commit/81b5b83ab3bf5377012c3c1b0b68fb4d8923e14b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
AVALANCHE: Fix memory leak in ghostDrawBackgroundItems

CID 1591697

(cherry picked from commit 2fc6a2a1586f146bd1322a3f8e15470fd05b8c12)

Changed paths:
    engines/avalanche/graphics.cpp


diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index f9f3e54ccf2..53e60bc94a9 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -621,11 +621,11 @@ void GraphicManager::ghostDrawBackgroundItems(Common::File &file) {
 		int height = cb._height + 1;
 
 		Graphics::Surface picture;
-		picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 
 		// Load the picture according to it's type.
 		switch (cb._flavour) {
 		case kFlavourOne: // There is only one plane.
+			picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 			for (uint16 y = 0; y < height; y++) {
 				for (uint16 x = 0; x < width; x += 8) {
 					byte pixel = file.readByte();
@@ -640,6 +640,7 @@ void GraphicManager::ghostDrawBackgroundItems(Common::File &file) {
 			picture = loadPictureRaw(file, width, height);
 			break;
 		default:
+			picture.create(width, height, Graphics::PixelFormat::createFormatCLUT8());
 			break;
 		}
 


Commit: 3353d492b3a7d9ba30c232c33a04bb0e1ac013e0
    https://github.com/scummvm/scummvm/commit/3353d492b3a7d9ba30c232c33a04bb0e1ac013e0
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
COMMON: Fix memory leak in Cel3DODecoder

CID 1591690

(cherry picked from commit cbea9d57cb6b71f9c71056949b4beb163b96ecfa)

Changed paths:
    image/cel_3do.cpp


diff --git a/image/cel_3do.cpp b/image/cel_3do.cpp
index 12c6cda0699..b49f62b2c30 100644
--- a/image/cel_3do.cpp
+++ b/image/cel_3do.cpp
@@ -109,6 +109,7 @@ bool Cel3DODecoder::loadStream(Common::SeekableReadStream &stream) {
 
 	// Only RGB555 is supported
 	if ((pre0 & 0x17) != 0x16) {
+		surface->free();
 		delete surface;
 		return false;
 	}


Commit: 0f8d586241de1abe27c85a5032113ee816b33e7e
    https://github.com/scummvm/scummvm/commit/0f8d586241de1abe27c85a5032113ee816b33e7e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
NGI: Fix memory leaks

CID 1591678
CID 1591664

(cherry picked from commit c294988090676ef23bd9b442526e44baf81d3ffb)

Changed paths:
    engines/ngi/motion.cpp


diff --git a/engines/ngi/motion.cpp b/engines/ngi/motion.cpp
index 83317e65d95..4e237eebd49 100644
--- a/engines/ngi/motion.cpp
+++ b/engines/ngi/motion.cpp
@@ -370,6 +370,8 @@ void MctlLadder::attachObject(StaticANIObject *obj) {
 			_aniHandler.attachObject(obj->_id);
 			_ladmovements.push_back(movement);
 		} else {
+			delete movement->movVars;
+			delete[] movement->staticIds;
 			delete movement;
 		}
 	}
@@ -385,6 +387,8 @@ int MctlLadder::findObjectPos(StaticANIObject *obj) {
 
 bool MctlLadder::initMovement(StaticANIObject *ani, MctlLadderMovement *movement) {
 	debugC(4, kDebugPathfinding, "MctlLadder::initMovement(*%d, ...)", ani->_id);
+	movement->movVars = nullptr;
+	movement->staticIds = nullptr;
 
 	GameVar *v = g_nmi->getGameLoaderGameVar()->getSubVarByName(ani->getName());
 


Commit: fe9df09d1bd996cd0831954e099352705300efdc
    https://github.com/scummvm/scummvm/commit/fe9df09d1bd996cd0831954e099352705300efdc
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
ZVISION: Fix memory leak

CID 1591627

(cherry picked from commit cc455216bbf1b6119783986ebc2679abbac0e6b5)

Changed paths:
    engines/zvision/scripting/actions.cpp


diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 2cbd5fe934a..da35678cfa8 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -797,6 +797,7 @@ bool ActionRegion::execute() {
 
 		EffectMap *_map = _engine->getRenderManager()->makeEffectMap(tempMask, 0);
 		effect = new FogFx(_engine, _slotKey, _rect, _unk1, _map, buf);
+		tempMask.free();
 	}
 	break;
 	default:


Commit: dc90cd306ed942f8d53e7d495bc0958713ff3295
    https://github.com/scummvm/scummvm/commit/dc90cd306ed942f8d53e7d495bc0958713ff3295
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
IMMORTAL: Fix memory leaks when decompressing

CID 1509048
CID 1509032

(cherry picked from commit 099163f422c3b659d18e50bf72f928aee43393c4)

Changed paths:
    engines/immortal/compression.cpp


diff --git a/engines/immortal/compression.cpp b/engines/immortal/compression.cpp
index 344b8c7ecf5..1e874b688cf 100644
--- a/engines/immortal/compression.cpp
+++ b/engines/immortal/compression.cpp
@@ -49,6 +49,11 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
 	 * Stack contains the currently being recreated string before it gets sent to the output
 	 */
 
+	// If the source data has no length, we certainly do not want to decompress it
+	if (lSource == 0) {
+		return nullptr;
+	}
+
 	// In the source, the data allocated here is a pointer passed to the function, but it's only used by this anyway
 	uint16 *pCodes = (uint16 *)malloc(k8K);		// The Codes stack has 8 * 1024 bytes allocated
 	uint16 *pTk    = (uint16 *)malloc(k8K);		// The Tk has 8 * 1024 bytes allocated
@@ -63,11 +68,6 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
 	uint16 findEmpty = 0;
 	uint16 index     = 0;
 
-	// If the source data has no length, we certainly do not want to decompress it
-	if (lSource == 0) {
-		return nullptr;
-	}
-
 	/* This will be the dynamically re-allocated writeable memory stream.
 	 * We do not want it to be deleted from scope, as this location is where
 	 * the readstream being returned will point to.
@@ -146,6 +146,9 @@ Common::SeekableReadStream *ImmortalEngine::unCompress(Common::File *source, int
 		oldCode = inCode;
 	}
 
+	free(pCodes);
+	free(pTk);
+
 	/* Return a readstream with a pointer to the data in the write stream.
 	 * This one we do want to dispose after using, because it will be in the scope of the engine itself
 	 */


Commit: 94afac6a11abeed4b58bda8335f879bcc65f48a3
    https://github.com/scummvm/scummvm/commit/94afac6a11abeed4b58bda8335f879bcc65f48a3
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-04-29T14:14:39+02:00

Commit Message:
BACKENDS: MACOS: Print a warning when no files are found in CDDAFS volumes

getChildren() may have succeeded but found no children at all, for some
reason. Properly print a warning in this case as well.

(cherry picked from commit fb2500e16b7319d7fe9de7ccb296464b42269e22)

Changed paths:
    backends/audiocd/macosx/macosx-audiocd.cpp


diff --git a/backends/audiocd/macosx/macosx-audiocd.cpp b/backends/audiocd/macosx/macosx-audiocd.cpp
index c23d9a7856a..53a8c2824f6 100644
--- a/backends/audiocd/macosx/macosx-audiocd.cpp
+++ b/backends/audiocd/macosx/macosx-audiocd.cpp
@@ -267,7 +267,7 @@ bool MacOSXAudioCDManager::findTrackNames(const Common::Path &drivePath) {
 	}
 
 	Common::FSList children;
-	if (!directory.getChildren(children, Common::FSNode::kListFilesOnly)) {
+	if (!directory.getChildren(children, Common::FSNode::kListFilesOnly) || children.empty()) {
 		warning("Failed to find children for '%s'", drivePath.toString(Common::Path::kNativeSeparator).c_str());
 		return false;
 	}


Commit: ac994e599acf130539bc997920381a01b3968795
    https://github.com/scummvm/scummvm/commit/ac994e599acf130539bc997920381a01b3968795
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-04-29T14:17:01+02:00

Commit Message:
BACKENDS: FS: Work around broken `d_type` values for cddafs in macOS < 10.6.2

This fixes Indy3 FM-TOWNS music being silent on macOS Tiger, when
playing from the original CD.

A more comprehensive fix was added in GH-6505 PR for the 2.10.0 release,
but for bugfix 2.9.1 I've reworked it so that a more minimal fix is
used, only targeting the impacted old macOS releases.

Changed paths:
    backends/fs/posix/posix-fs.cpp


diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 368c7c87ebf..ce1ebcbebc0 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -38,6 +38,7 @@
 #include <sys/param.h>
 #include <sys/stat.h>
 #ifdef MACOSX
+#include <AvailabilityMacros.h>
 #include <sys/types.h>
 #endif
 #ifdef PSP2
@@ -202,7 +203,19 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
 		 */
 		entry.setFlags();
 #else
-		if (dp->d_type == DT_UNKNOWN) {
+		// HACK: Before macOS 10.6.2, the cddafs module would return bogus values
+		// (kAppleCDDAXMLFileType or kAppleCDDATrackType) for Audio CD volumes,
+		// instead of DT_REG. A more comprehensive fix is used in newer ScummVM
+		// releases, but for 2.9.x we avoid changing too much, and just apply a
+		// smaller fix that's only targeting older macOS.
+		if (dp->d_type == DT_UNKNOWN
+#  if defined(MACOSX) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1070
+#    define kAppleCDDATrackType    2
+#    define kAppleCDDAXMLFileType  3
+			|| dp->d_type == kAppleCDDATrackType
+			|| dp->d_type == kAppleCDDAXMLFileType
+#  endif
+			) {
 			// Fall back to stat()
 			entry.setFlags();
 		} else {




More information about the Scummvm-git-logs mailing list