[Scummvm-git-logs] scummvm master -> 6d3e547f35047f92484d77eb63ffa60fe0502f05

sluicebox noreply at scummvm.org
Mon Mar 9 22:38:43 UTC 2026


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

Summary:
8ba0cfba0a TINSEL: Fix NOIR memory leaks
6d3e547f35 TINSEL: Fix crash when engine fails to initialize


Commit: 8ba0cfba0a438cf617e414481e7ef2c7c9d9eb5c
    https://github.com/scummvm/scummvm/commit/8ba0cfba0a438cf617e414481e7ef2c7c9d9eb5c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2026-03-09T17:38:35-05:00

Commit Message:
TINSEL: Fix NOIR memory leaks

Changed paths:
    engines/tinsel/tinsel.cpp


diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 45027874ac7..3efabb21c59 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -934,6 +934,8 @@ TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc)
 TinselEngine::~TinselEngine() {
 	_system->getAudioCDManager()->stop();
 	delete _spriter;
+	delete _systemReel;
+	delete _notebook;
 	delete _cursor;
 	delete _bg;
 	delete _font;


Commit: 6d3e547f35047f92484d77eb63ffa60fe0502f05
    https://github.com/scummvm/scummvm/commit/6d3e547f35047f92484d77eb63ffa60fe0502f05
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2026-03-09T17:38:35-05:00

Commit Message:
TINSEL: Fix crash when engine fails to initialize

TinselEngine calls MemoryDeinit() on destruction, but this function
assumes that MemoryInit() has initialized a static array of structs
with valid pointers. If TinselEngine is destroyed before run() is
called, or before run() can call MemoryInit(), then invalid pointers
are dereferenced by MemoryDeinit().

For example, this occurs when attempting to load NOIR when TINYGL is not
enabled.

As the memory functions operate on a static array of structs with no
explicit initialization, there is not a simple value that can be tested
to see if initialization has occurred, so I added one.

Changed paths:
    engines/tinsel/tinsel.cpp
    engines/tinsel/tinsel.h


diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 3efabb21c59..0f757f1a125 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -905,7 +905,8 @@ const char *const TinselEngine::_sceneFiles[] = {
 
 TinselEngine::TinselEngine(OSystem *syst, const TinselGameDescription *gameDesc) :
 		Engine(syst), _gameDescription(gameDesc), _random("tinsel"),
-		_sound(0), _midiMusic(0), _pcmMusic(0), _bmv(0) {
+		_sound(0), _midiMusic(0), _pcmMusic(0), _bmv(0),
+		_memoryManagerInitialized(false) {
 	_vm = this;
 
 	_gameId = 0;
@@ -957,7 +958,9 @@ TinselEngine::~TinselEngine() {
 	delete _actor;
 	delete _config;
 
-	MemoryDeinit();
+	if (_memoryManagerInitialized) {
+		MemoryDeinit();
+	}
 
 	// Reset global vars
 	ResetVarsDrives();	// drives.cpp
@@ -1066,6 +1069,7 @@ Common::Error TinselEngine::run() {
 
 	// init memory manager
 	MemoryInit();
+	_memoryManagerInitialized = true;
 
 	// load user configuration
 	_vm->_config->readFromDisk();
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index 9643e3a9495..a3d79cb6930 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -210,6 +210,7 @@ public:
 	Notebook *_notebook = nullptr;
 	SystemReel *_systemReel = nullptr;
 	Spriter *_spriter = nullptr;
+	bool _memoryManagerInitialized;
 
 	KEYFPTR _keyHandler;
 




More information about the Scummvm-git-logs mailing list