Skip to content

Commit

Permalink
TONY: Properly free dialog commands during loading when there is dupl…
Browse files Browse the repository at this point in the history
…icates
  • Loading branch information
dreammaster committed Jun 9, 2012
1 parent 5e062ce commit 8d6f504
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions engines/tony/mpal/loadmpc.cpp
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 8d6f504

Please sign in to comment.