diff options
author | Borja Lorente | 2016-08-13 18:13:29 +0200 |
---|---|---|
committer | Borja Lorente | 2016-08-19 16:29:17 +0200 |
commit | 28698ba697012edd1b3159400342d04b5d3df530 (patch) | |
tree | 6d26f2654fc8f67fd9adfbf9f45ca90ca0aee495 /engines | |
parent | 2f2d9bead758a001e3e003bc782540ad4c0c3d22 (diff) | |
download | scummvm-rg350-28698ba697012edd1b3159400342d04b5d3df530.tar.gz scummvm-rg350-28698ba697012edd1b3159400342d04b5d3df530.tar.bz2 scummvm-rg350-28698ba697012edd1b3159400342d04b5d3df530.zip |
MACVENTURE: Fix leak on loadControls
Diffstat (limited to 'engines')
-rw-r--r-- | engines/macventure/controls.h | 2 | ||||
-rw-r--r-- | engines/macventure/gui.cpp | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/engines/macventure/controls.h b/engines/macventure/controls.h index a780f6328b..574ae6afbe 100644 --- a/engines/macventure/controls.h +++ b/engines/macventure/controls.h @@ -69,7 +69,7 @@ struct ControlData { ControlAction refcon; ControlType type; uint8 titleLength; - char* title; + Common::String title; uint16 border; }; diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 834ffc1e19..bf8455eb91 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -512,9 +512,11 @@ bool Gui::loadControls() { data.type = (ControlType)id; id++; data.titleLength = res->readByte(); if (data.titleLength) { - data.title = new char[data.titleLength + 1]; - res->read(data.title, data.titleLength); - data.title[data.titleLength] = '\0'; + char *title = new char[data.titleLength + 1]; + res->read(title, data.titleLength); + title[data.titleLength] = '\0'; + data.title = Common::String(title); + delete[] title; } if (data.type != kControlExitBox) { BorderBounds bbs = borderBounds(getWindowData(kCommandsWindow).type); |