diff options
author | Paul Gilbert | 2012-06-09 11:57:07 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-06-09 11:57:07 +1000 |
commit | 5e062ce86c87c0253fc237c6c26ed9d9293ef571 (patch) | |
tree | 0bbf095740bab71a3a41d115b2538412c09b5bf6 /engines/tony/mpal | |
parent | dd8b4b519a2a61e010d9aa4d71b5f123dfeffc6b (diff) | |
download | scummvm-rg350-5e062ce86c87c0253fc237c6c26ed9d9293ef571.tar.gz scummvm-rg350-5e062ce86c87c0253fc237c6c26ed9d9293ef571.tar.bz2 scummvm-rg350-5e062ce86c87c0253fc237c6c26ed9d9293ef571.zip |
TONY: Properly free items during loading when there is duplicates
Diffstat (limited to 'engines/tony/mpal')
-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 e222891170..bb2c999984 100644 --- a/engines/tony/mpal/loadmpc.cpp +++ b/engines/tony/mpal/loadmpc.cpp @@ -421,6 +421,16 @@ static const byte *parseItem(const byte *lpBuf, LPMPALITEM lpmiItem) { for (kk = 0; kk < curCmd; kk++) { if (compareCommands(&lpmiItem->_command[kk], &lpmiItem->_command[curCmd])) { lpmiItem->Action[i].CmdNum[j] = kk; + + // Free any data allocated for the duplictaed command + if (lpmiItem->_command[curCmd].type == 2) { + globalDestroy(lpmiItem->_command[curCmd].lpszVarName); + freeExpression(lpmiItem->_command[curCmd].expr); + + lpmiItem->_command[curCmd].lpszVarName = NULL; + lpmiItem->_command[curCmd].expr = 0; + lpmiItem->_command[curCmd].type = 0; + } break; } } |