From d9eebaf787cb1e4e643d0d4704617d82a94acbcc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Sep 2017 12:26:43 -0400 Subject: [PATCH] TITANIC: Fix leak of vocab synonyms on exit --- engines/titanic/true_talk/tt_node.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/engines/titanic/true_talk/tt_node.cpp b/engines/titanic/true_talk/tt_node.cpp index fece3b8889f..565c4664a95 100644 --- a/engines/titanic/true_talk/tt_node.cpp +++ b/engines/titanic/true_talk/tt_node.cpp @@ -58,9 +58,10 @@ void TTnode::deleteSiblings() { _priorP->_nextP = nullptr; // Iterate through the linked chain of nodes, deleting each in turn - for (TTnode *curP = _nextP, *nextP = nullptr; nextP; curP = nextP) { - nextP = curP->_nextP; - delete curP; + while (_nextP) { + TTnode *next = _nextP; + _nextP = next->_nextP; + delete next; } }