aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2015-11-25 00:22:24 +0100
committerStrangerke2015-11-25 00:22:24 +0100
commit8e161e003529b9ffb703783264b29403ddf0ec97 (patch)
tree18b9a2195c4d3addf555ce35f85b3fcddd23278a
parent4cf4387ce42a655a30d37b8a54e6eacf64d14158 (diff)
downloadscummvm-rg350-8e161e003529b9ffb703783264b29403ddf0ec97.tar.gz
scummvm-rg350-8e161e003529b9ffb703783264b29403ddf0ec97.tar.bz2
scummvm-rg350-8e161e003529b9ffb703783264b29403ddf0ec97.zip
MADS: NEBULAR: Fix another (potential) memory leak
-rw-r--r--engines/mads/nebular/dialogs_nebular.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/engines/mads/nebular/dialogs_nebular.cpp b/engines/mads/nebular/dialogs_nebular.cpp
index a5c6a56049..ede16e1f99 100644
--- a/engines/mads/nebular/dialogs_nebular.cpp
+++ b/engines/mads/nebular/dialogs_nebular.cpp
@@ -82,11 +82,14 @@ bool DialogsNebular::show(int messageId, int objectId) {
if (centerFlag) {
crFlag = true;
} else {
- if (objectId == -1) {
+ if (dialog)
+ delete dialog;
+
+ if (objectId == -1)
dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth);
- } else {
+ else
dialog = new PictureDialog(_vm, _defaultPosition, _dialogWidth, objectId);
- }
+
dialog->wordWrap(dialogText);
dialog->incNumLines();
}
@@ -146,11 +149,10 @@ bool DialogsNebular::show(int messageId, int objectId) {
}
if (!dialog) {
- if (objectId == -1) {
+ if (objectId == -1)
dialog = new TextDialog(_vm, FONT_INTERFACE, _defaultPosition, _dialogWidth);
- } else {
+ else
dialog = new PictureDialog(_vm, _defaultPosition, _dialogWidth, objectId);
- }
}
if (centerFlag) {