[Scummvm-git-logs] scummvm master -> 5ecd4b0bbd03c5ba4229fed0fc91fbf694935791

yuv422 yuv422 at users.noreply.github.com
Sat Feb 29 23:45:35 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:
5ecd4b0bbd ILLUSIONS: Fix some memory leaks (#2106)


Commit: 5ecd4b0bbd03c5ba4229fed0fc91fbf694935791
    https://github.com/scummvm/scummvm/commit/5ecd4b0bbd03c5ba4229fed0fc91fbf694935791
Author: Anubhab Ghosh (anubhabghosh.me at gmail.com)
Date: 2020-03-01T10:45:32+11:00

Commit Message:
ILLUSIONS: Fix some memory leaks (#2106)

Changed paths:
    engines/illusions/actor.cpp
    engines/illusions/duckman/duckman_specialcode.cpp
    engines/illusions/gamarchive.cpp
    engines/illusions/gamestate.cpp
    engines/illusions/screentext.cpp
    engines/illusions/thread.cpp
    engines/illusions/thread.h


diff --git a/engines/illusions/actor.cpp b/engines/illusions/actor.cpp
index c052a275c1..f32b43b49d 100644
--- a/engines/illusions/actor.cpp
+++ b/engines/illusions/actor.cpp
@@ -1006,6 +1006,7 @@ Controls::Controls(IllusionsEngine *vm)
 
 Controls::~Controls() {
 	delete _sequenceOpcodes;
+	destroyControls();
 }
 
 void Controls::placeBackgroundObject(BackgroundObject *backgroundObject) {
diff --git a/engines/illusions/duckman/duckman_specialcode.cpp b/engines/illusions/duckman/duckman_specialcode.cpp
index b00579befe..b5cdb966f8 100644
--- a/engines/illusions/duckman/duckman_specialcode.cpp
+++ b/engines/illusions/duckman/duckman_specialcode.cpp
@@ -60,6 +60,10 @@ DuckmanSpecialCode::~DuckmanSpecialCode() {
 	delete _propertyTimers;
 	delete _inventory;
 	delete _credits;
+
+	for (SpecialCodeMap::iterator it = _specialCodeMap.begin(); it != _specialCodeMap.end(); ++it) {
+		delete (*it)._value;
+	}
 }
 
 typedef Common::Functor1Mem<OpCall&, void, DuckmanSpecialCode> SpecialCodeFunctionDM;
diff --git a/engines/illusions/gamarchive.cpp b/engines/illusions/gamarchive.cpp
index cda7859386..0061cce24c 100644
--- a/engines/illusions/gamarchive.cpp
+++ b/engines/illusions/gamarchive.cpp
@@ -34,6 +34,7 @@ GamArchive::GamArchive(const char *filename)
 
 GamArchive::~GamArchive() {
 	delete[] _groups;
+	delete _fd;
 }
 
 byte *GamArchive::readResource(uint32 sceneId, uint32 resId, uint32 &dataSize) {
diff --git a/engines/illusions/gamestate.cpp b/engines/illusions/gamestate.cpp
index caf8584f22..1cafb770d9 100644
--- a/engines/illusions/gamestate.cpp
+++ b/engines/illusions/gamestate.cpp
@@ -43,6 +43,7 @@ void GameState::writeState(uint32 sceneId, uint32 threadId) {
 	writeStream->writeUint32LE(sceneId);
 	writeStream->writeUint32LE(threadId);
 	writeStateInternal(writeStream);
+	delete writeStream;
 }
 
 void GameState::read(Common::ReadStream *in) {
diff --git a/engines/illusions/screentext.cpp b/engines/illusions/screentext.cpp
index f4281144c2..07cc96dc30 100644
--- a/engines/illusions/screentext.cpp
+++ b/engines/illusions/screentext.cpp
@@ -36,6 +36,7 @@ ScreenText::ScreenText(IllusionsEngine *vm)
 }
 
 ScreenText::~ScreenText() {
+	freeTextSurface();
 }
 
 void ScreenText::getTextInfoDimensions(WidthHeight &textInfoDimensions) {
diff --git a/engines/illusions/thread.cpp b/engines/illusions/thread.cpp
index 084b28d949..300f56604b 100644
--- a/engines/illusions/thread.cpp
+++ b/engines/illusions/thread.cpp
@@ -344,4 +344,12 @@ bool ThreadList::isActiveThread(int msgNum) {
 	return false;
 }
 
+ThreadList::~ThreadList() {
+	Iterator it = _threads.begin();
+	while (it != _threads.end()) {
+		delete *it;
+		it = _threads.erase(it);
+	}
+}
+
 } // End of namespace Illusions
diff --git a/engines/illusions/thread.h b/engines/illusions/thread.h
index 20edac07af..b9f542e6c0 100644
--- a/engines/illusions/thread.h
+++ b/engines/illusions/thread.h
@@ -105,6 +105,7 @@ public:
 	void setThreadSceneId(uint32 threadId, uint32 sceneId);
 	uint32 getThreadSceneId(uint32 threadId);
 	bool isActiveThread(int msgNum);
+	~ThreadList();
 protected:
 	typedef Common::List<Thread*> List;
 	typedef List::iterator Iterator;




More information about the Scummvm-git-logs mailing list