TONY: Properly free dialog commands during loading when there is duplicates

This commit is contained in:
Paul Gilbert 2012-06-09 12:29:34 +10:00
parent 5e062ce86c
commit 8d6f50463e

View File

@ -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;
}
}