[Scummvm-git-logs] scummvm master -> 2abf08ad621f800775d7fd8c57ca54f8bd14749a
kelmer44
noreply at scummvm.org
Wed Sep 17 10:00:08 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
2abf08ad62 TOT: Fixes memory leaks on sound handle and dialog
Commit: 2abf08ad621f800775d7fd8c57ca54f8bd14749a
https://github.com/scummvm/scummvm/commit/2abf08ad621f800775d7fd8c57ca54f8bd14749a
Author: kelmer (kelmer at gmail.com)
Date: 2025-09-17T11:55:33+02:00
Commit Message:
TOT: Fixes memory leaks on sound handle and dialog
Changed paths:
engines/tot/anims.cpp
engines/tot/forest.cpp
engines/tot/forest.h
engines/tot/sound.cpp
diff --git a/engines/tot/anims.cpp b/engines/tot/anims.cpp
index 397ab205cf9..58628f8fb31 100644
--- a/engines/tot/anims.cpp
+++ b/engines/tot/anims.cpp
@@ -988,9 +988,9 @@ void drawFlc(
}
} while (loopNumber <= loop && !g_engine->shouldQuit());
flic->stop();
- delete flic;
Lexit_proc:
animationsFile.close();
+ delete flic;
}
void clearAnims() {
diff --git a/engines/tot/forest.cpp b/engines/tot/forest.cpp
index 58792663b3b..eefd0bf1384 100644
--- a/engines/tot/forest.cpp
+++ b/engines/tot/forest.cpp
@@ -24,7 +24,7 @@
namespace Tot {
void initTree(Tree &a, nodeElement data) {
- a = new treeDef;
+ a = new TreeDef;
a->element = data;
a->parent = nullptr;
a->sibling = nullptr;
@@ -77,7 +77,7 @@ void expandNode(Tree &node, nodeElement data) {
while (aux->sibling != nullptr)
aux = rightSibling(aux);
;
- aux->sibling = new treeDef;
+ aux->sibling = new TreeDef;
aux = aux->sibling;
aux->element = data;
aux->sibling = nullptr;
@@ -85,7 +85,7 @@ void expandNode(Tree &node, nodeElement data) {
aux->parent = node;
} else {
- aux->child = new treeDef;
+ aux->child = new TreeDef;
aux = aux->child;
aux->element = data;
aux->sibling = nullptr;
diff --git a/engines/tot/forest.h b/engines/tot/forest.h
index 9803b4b77da..e3d696ecdbc 100644
--- a/engines/tot/forest.h
+++ b/engines/tot/forest.h
@@ -30,11 +30,16 @@ struct nodeElement {
uint index;
};
-typedef struct treeDef *Tree;
+typedef struct TreeDef *Tree;
-struct treeDef {
+struct TreeDef {
nodeElement element;
Tree parent, sibling, child;
+
+ ~TreeDef() {
+ delete sibling;
+ delete child;
+ }
};
void initTree(Tree &a, nodeElement data);
diff --git a/engines/tot/sound.cpp b/engines/tot/sound.cpp
index d093c5cd920..1eadf1c1665 100644
--- a/engines/tot/sound.cpp
+++ b/engines/tot/sound.cpp
@@ -81,6 +81,10 @@ void SoundManager::loadVoc(Common::String vocFile, int32 startPos, int16 size) {
vocResource.seek(startPos);
_lastSrcStream = vocResource.readStream((uint32)size);
}
+ if(_audioStream) {
+ delete _audioStream;
+ _audioStream = nullptr;
+ }
_audioStream = Audio::makeVOCStream(_lastSrcStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
}
More information about the Scummvm-git-logs
mailing list