diff options
author | Paul Gilbert | 2012-06-09 12:29:34 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-06-09 12:29:34 +1000 |
commit | 8d6f50463ee0541e2d4609f80443537adefdd35e (patch) | |
tree | 4f2ce397eb08e93f578077a3e6b97d9f34f27e50 /engines/tony | |
parent | 5e062ce86c87c0253fc237c6c26ed9d9293ef571 (diff) | |
download | scummvm-rg350-8d6f50463ee0541e2d4609f80443537adefdd35e.tar.gz scummvm-rg350-8d6f50463ee0541e2d4609f80443537adefdd35e.tar.bz2 scummvm-rg350-8d6f50463ee0541e2d4609f80443537adefdd35e.zip |
TONY: Properly free dialog commands during loading when there is duplicates
Diffstat (limited to 'engines/tony')
-rw-r--r-- | engines/tony/mpal/loadmpc.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/tony/mpal/loadmpc.cpp b/engines/tony/mpal/loadmpc.cpp index bb2c999984..d0b6a75f72 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -238,6 +238,16 @@ static const byte *parseDialog(const byte *lpBuf, LPMPALDIALOG lpmdDialog) { for (kk = 0;kk < curCmd; kk++) { if (compareCommands(&lpmdDialog->_command[kk], &lpmdDialog->_command[curCmd])) { lpmdDialog->_group[i].CmdNum[j] = kk; + + // Free any data allocated for the duplictaed command + if (lpmdDialog->_command[curCmd].type == 2) { + globalDestroy(lpmdDialog->_command[curCmd].lpszVarName); + freeExpression(lpmdDialog->_command[curCmd].expr); + + lpmdDialog->_command[curCmd].lpszVarName = NULL; + lpmdDialog->_command[curCmd].expr = 0; + lpmdDialog->_command[curCmd].type = 0; + } break; } } |