[Scummvm-git-logs] scummvm master -> bc7dcc0366bb167900ad3d3c6d632aba0057cb4e

sluicebox noreply at scummvm.org
Thu Nov 2 16:29:35 UTC 2023


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

Summary:
6454e0cab0 DEVTOOLS: Fix memory leak in create_translations
f1426f42a0 COMPOSER: Fix memory leak when loading save
bbf932a911 GRIFFON: Fix memory leak when initializing
d36331ba98 HPL1: Fix memory leak
b00616a98d LURE: Fix memory leak in status window hotspots
3809934d21 MACVENTURE: Fix memory leak in text decoding
4fcb00a835 NGI: Fix memory leaks when flipping bitmaps
fa6454ef4f PRIVATE: Fix memory leaks in locations and inventory
23901f22ee TITANIC: Fix memory leak
bc7dcc0366 SCUMM: Fix out of bounds array access


Commit: 6454e0cab0fba6c032cdfef75e472943b65a009e
    https://github.com/scummvm/scummvm/commit/6454e0cab0fba6c032cdfef75e472943b65a009e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:13-07:00

Commit Message:
DEVTOOLS: Fix memory leak in create_translations

Coverity CID 1432243

Changed paths:
    devtools/create_translations/po_parser.cpp


diff --git a/devtools/create_translations/po_parser.cpp b/devtools/create_translations/po_parser.cpp
index 6b451f57388..83b336b2dfe 100644
--- a/devtools/create_translations/po_parser.cpp
+++ b/devtools/create_translations/po_parser.cpp
@@ -144,6 +144,7 @@ void PoMessageEntryList::addMessageEntry(const char *translation, const char *me
 		if (strcmp(str, "utf-8") != 0 && strcmp(str, "UTF-8") != 0) {
 			_useUTF8 = false;
 		}
+		delete[] str;
 		return;
 	}
 


Commit: f1426f42a0a5bc534812466954f8167192f6f367
    https://github.com/scummvm/scummvm/commit/f1426f42a0a5bc534812466954f8167192f6f367
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:13-07:00

Commit Message:
COMPOSER: Fix memory leak when loading save

Coverity CID 1365422

Changed paths:
    engines/composer/saveload.cpp


diff --git a/engines/composer/saveload.cpp b/engines/composer/saveload.cpp
index 83f59bf9398..1c3a4e501fc 100644
--- a/engines/composer/saveload.cpp
+++ b/engines/composer/saveload.cpp
@@ -190,8 +190,10 @@ void ComposerEngine::sync<Pipe *>(Common::Serializer &ser, Pipe *&data, Common::
 			ser.syncAsUint32LE(tmp);
 			for (uint32 k = tmp; k > 0; k--) {
 				ser.syncAsUint16LE(id);
-				if (data->hasResource(tag, id))
-					data->getResource(tag, id, true);
+				if (data->hasResource(tag, id)) {
+					Common::SeekableReadStream *s = data->getResource(tag, id, true);
+					delete s;
+				}
 			}
 		}
 	} else {


Commit: bbf932a91122124fb0e63dd7f5ed4f83418f1d7f
    https://github.com/scummvm/scummvm/commit/bbf932a91122124fb0e63dd7f5ed4f83418f1d7f
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:14-07:00

Commit Message:
GRIFFON: Fix memory leak when initializing

Coverity CID 1506377

Changed paths:
    engines/griffon/griffon.cpp


diff --git a/engines/griffon/griffon.cpp b/engines/griffon/griffon.cpp
index 2a4bbc1056e..750300cb4c7 100644
--- a/engines/griffon/griffon.cpp
+++ b/engines/griffon/griffon.cpp
@@ -137,7 +137,8 @@ Common::Error GriffonEngine::run() {
 		ttsMan->enable(ConfMan.getBool("tts_enabled"));
 	}
 
-	initGraphics(320, 240, new Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+	Graphics::PixelFormat pixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0);
+	initGraphics(320, 240, &pixelFormat);
 
 	_mixer = g_system->getMixer();
 


Commit: d36331ba98600efa41e16aa23684229c2ee44cb7
    https://github.com/scummvm/scummvm/commit/d36331ba98600efa41e16aa23684229c2ee44cb7
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:15-07:00

Commit Message:
HPL1: Fix memory leak

Coverity CID 1518937

Changed paths:
    engines/hpl1/engine/resources/MaterialManager.cpp


diff --git a/engines/hpl1/engine/resources/MaterialManager.cpp b/engines/hpl1/engine/resources/MaterialManager.cpp
index 75f8807c885..3a97897752f 100644
--- a/engines/hpl1/engine/resources/MaterialManager.cpp
+++ b/engines/hpl1/engine/resources/MaterialManager.cpp
@@ -195,6 +195,7 @@ tString cMaterialManager::GetPhysicsMaterialName(const tString &asName) {
 	if (pMaterial == NULL && sPath != "") {
 		TiXmlDocument *pDoc = hplNew(TiXmlDocument, (sPath.c_str()));
 		if (!pDoc->LoadFile()) {
+			hplDelete(pDoc);
 			return "";
 		}
 


Commit: b00616a98d54be4098c42358f8117be9a4f8d82b
    https://github.com/scummvm/scummvm/commit/b00616a98d54be4098c42358f8117be9a4f8d82b
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:15-07:00

Commit Message:
LURE: Fix memory leak in status window hotspots

Coverity CID 1003910

Changed paths:
    engines/lure/hotspots.cpp


diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp
index fee62c636f9..0dea79b73db 100644
--- a/engines/lure/hotspots.cpp
+++ b/engines/lure/hotspots.cpp
@@ -1936,6 +1936,7 @@ void Hotspot::doStatus(HotspotData *hotspot) {
 
 	Surface *s = Surface::newDialog(INFO_DIALOG_WIDTH, buffer);
 	s->copyToScreen(INFO_DIALOG_X, (FULL_SCREEN_HEIGHT-s->height())/2);
+	delete s;
 
 	Events::getReference().waitForPress();
 	screen.update();


Commit: 3809934d21c0ee67816f085a02fbb5b2ccc13d70
    https://github.com/scummvm/scummvm/commit/3809934d21c0ee67816f085a02fbb5b2ccc13d70
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:26:16-07:00

Commit Message:
MACVENTURE: Fix memory leak in text decoding

Coverity CID 1362449

Changed paths:
    engines/macventure/text.cpp


diff --git a/engines/macventure/text.cpp b/engines/macventure/text.cpp
index 3949c9d0768..8eff4338527 100644
--- a/engines/macventure/text.cpp
+++ b/engines/macventure/text.cpp
@@ -108,6 +108,7 @@ void TextAsset::decodeOld() {
 	str[strLen] = '\0';
 	debugC(3, kMVDebugText, "Decoded string [%d] (old encoding): %s", _id, str);
 	_decoded = Common::String(str);
+	delete[] str;
 }
 
 void TextAsset::decodeHuffman() {


Commit: 4fcb00a8356b8a617d17fa9dc8c128d2add72bd1
    https://github.com/scummvm/scummvm/commit/4fcb00a8356b8a617d17fa9dc8c128d2add72bd1
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:27:33-07:00

Commit Message:
NGI: Fix memory leaks when flipping bitmaps

Coverity CID 1433114
Coverity CID 1433128

Changed paths:
    engines/ngi/gfx.cpp
    engines/ngi/statics.cpp


diff --git a/engines/ngi/gfx.cpp b/engines/ngi/gfx.cpp
index 5858761232e..680b50526db 100644
--- a/engines/ngi/gfx.cpp
+++ b/engines/ngi/gfx.cpp
@@ -577,7 +577,9 @@ void Picture::draw(int x, int y, int style, int angle) {
 	case 1: {
 		//flip
 		const Dims dims = getDimensions();
-		_bitmap->flipVertical()->drawShaded(1, x1, y1 + 30 + dims.y, *pal, _alpha);
+		Bitmap *flipped = _bitmap->flipVertical();
+		flipped->drawShaded(1, x1, y1 + 30 + dims.y, *pal, _alpha);
+		delete flipped;
 		break;
 	}
 	case 2:
diff --git a/engines/ngi/statics.cpp b/engines/ngi/statics.cpp
index a27113da6ba..f5be08befac 100644
--- a/engines/ngi/statics.cpp
+++ b/engines/ngi/statics.cpp
@@ -496,7 +496,9 @@ void Movement::draw(bool flipFlag, int angle) {
 	}
 
 	if (flipFlag) {
-		bmp->flipVertical()->drawShaded(1, x, y + 30 + _currDynamicPhase->_rect.bottom, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
+		Bitmap *flipped = bmp->flipVertical();
+		flipped->drawShaded(1, x, y + 30 + _currDynamicPhase->_rect.bottom, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
+		delete flipped;
 	} else if (angle) {
 		bmp->drawRotated(x, y, angle, _currDynamicPhase->getPaletteData(), _currDynamicPhase->getAlpha());
 	} else {


Commit: fa6454ef4f10abb32f603a364f5e8f6fb224f92c
    https://github.com/scummvm/scummvm/commit/fa6454ef4f10abb32f603a364f5e8f6fb224f92c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:27:33-07:00

Commit Message:
PRIVATE: Fix memory leaks in locations and inventory

Coverity CID 1453259
Coverity CID 1453260

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 296832eb60b..71387f0d6ec 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1488,7 +1488,8 @@ void PrivateEngine::loadLocations(const Common::Rect &rect) {
 			Common::String s =
 				Common::String::format("%sdryloc%d.bmp", _diaryLocPrefix.c_str(), i);
 
-			loadMask(s, rect.left + 120, rect.top + offset, true);
+			Graphics::Surface *surface = loadMask(s, rect.left + 120, rect.top + offset, true);
+			delete surface;
 		}
 	}
 }
@@ -1497,7 +1498,8 @@ void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common
 	int16 offset = 0;
 	for (NameList::const_iterator it = inventory.begin(); it != inventory.end(); ++it) {
 		offset = offset + 22;
-		loadMask(*it, r1.left, r1.top + offset, true);
+		Graphics::Surface *surface = loadMask(*it, r1.left, r1.top + offset, true);
+		delete surface;
 	}
 }
 


Commit: 23901f22eec105b19cc0c7cd15d5258794e829c4
    https://github.com/scummvm/scummvm/commit/23901f22eec105b19cc0c7cd15d5258794e829c4
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:28:19-07:00

Commit Message:
TITANIC: Fix memory leak

TTsynonym constructor copies the value of the incoming string, it does
not take ownership.

Coverity CID 1361031

Changed paths:
    engines/titanic/true_talk/tt_synonym.cpp
    engines/titanic/true_talk/tt_synonym.h
    engines/titanic/true_talk/tt_word.cpp


diff --git a/engines/titanic/true_talk/tt_synonym.cpp b/engines/titanic/true_talk/tt_synonym.cpp
index 44e84af3c54..b4443418327 100644
--- a/engines/titanic/true_talk/tt_synonym.cpp
+++ b/engines/titanic/true_talk/tt_synonym.cpp
@@ -39,8 +39,8 @@ TTsynonym::TTsynonym(int mode, const char *str, FileHandle file) :
 	_file = file;
 }
 
-TTsynonym::TTsynonym(int mode, TTstring *str) : TTstringNode() {
-	_string = *str;
+TTsynonym::TTsynonym(int mode, const TTstring &str) : TTstringNode() {
+	_string = str;
 	initialize(mode);
 }
 
diff --git a/engines/titanic/true_talk/tt_synonym.h b/engines/titanic/true_talk/tt_synonym.h
index 2991334cb0a..0bda9b68278 100644
--- a/engines/titanic/true_talk/tt_synonym.h
+++ b/engines/titanic/true_talk/tt_synonym.h
@@ -32,7 +32,7 @@ public:
 	TTsynonym();
 	TTsynonym(const TTsynonym *src);
 	TTsynonym(int mode, const char *str, FileHandle file);
-	TTsynonym(int mode, TTstring *str);
+	TTsynonym(int mode, const TTstring &str);
 
 	/**
 	 * Copies data from one synonym to another
diff --git a/engines/titanic/true_talk/tt_word.cpp b/engines/titanic/true_talk/tt_word.cpp
index a6e9aef3277..009c9023c55 100644
--- a/engines/titanic/true_talk/tt_word.cpp
+++ b/engines/titanic/true_talk/tt_word.cpp
@@ -120,8 +120,7 @@ int TTword::setSynStr(TTstring &str) {
 	if (str.empty())
 		return 4;
 
-	TTstring *newStr = new TTstring(str);
-	TTsynonym *newSyn = new TTsynonym(4, newStr);
+	TTsynonym *newSyn = new TTsynonym(4, str);
 	setSyn(newSyn);
 	return 0;
 }


Commit: bc7dcc0366bb167900ad3d3c6d632aba0057cb4e
    https://github.com/scummvm/scummvm/commit/bc7dcc0366bb167900ad3d3c6d632aba0057cb4e
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-11-02T09:28:19-07:00

Commit Message:
SCUMM: Fix out of bounds array access

ScummEngine::runScript expects an array of size NUM_SCRIPT_LOCAL.

Coverity CID 1501555

Changed paths:
    engines/scumm/gfx_gui.cpp


diff --git a/engines/scumm/gfx_gui.cpp b/engines/scumm/gfx_gui.cpp
index ff51788f771..52433d0260a 100644
--- a/engines/scumm/gfx_gui.cpp
+++ b/engines/scumm/gfx_gui.cpp
@@ -2576,7 +2576,7 @@ bool ScummEngine::executeMainMenuOperationSegaCD(int op, int mouseX, int mouseY,
 			// This will let us know whether we have successfully loaded a game or not.
 
 			// First time...
-			int args[16];
+			int args[NUM_SCRIPT_LOCAL];
 			memset(args, 0, sizeof(args));
 			args[0] = _bootParam;
 




More information about the Scummvm-git-logs mailing list