diff options
author | Johannes Schickel | 2010-01-12 21:46:50 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-12 21:46:50 +0000 |
commit | af1ba4229812b74ea7c543cd14b34be0c9af5db6 (patch) | |
tree | b30708a1814aebd46b56a3042574b9b40d197913 /backends/vkeybd | |
parent | 62a87101d505d4f86a9504649ee7ffc3702b6189 (diff) | |
download | scummvm-rg350-af1ba4229812b74ea7c543cd14b34be0c9af5db6.tar.gz scummvm-rg350-af1ba4229812b74ea7c543cd14b34be0c9af5db6.tar.bz2 scummvm-rg350-af1ba4229812b74ea7c543cd14b34be0c9af5db6.zip |
Fix some memory leaks.
svn-id: r47284
Diffstat (limited to 'backends/vkeybd')
-rw-r--r-- | backends/vkeybd/virtual-keyboard-parser.cpp | 7 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard.h | 8 |
2 files changed, 12 insertions, 3 deletions
diff --git a/backends/vkeybd/virtual-keyboard-parser.cpp b/backends/vkeybd/virtual-keyboard-parser.cpp index 7af6d2a49f..68e7c7ec75 100644 --- a/backends/vkeybd/virtual-keyboard-parser.cpp +++ b/backends/vkeybd/virtual-keyboard-parser.cpp @@ -154,8 +154,11 @@ bool VirtualKeyboardParser::parserCallback_mode(ParserNode *node) { } else { // remove data relating to old resolution _mode->bitmapName.clear(); - delete _mode->image; - _mode->image = 0; + if (_mode->image) { + _mode->image->free(); + delete _mode->image; + _mode->image = 0; + } _mode->imageMap.removeAllAreas(); _mode->displayArea = Rect(); } diff --git a/backends/vkeybd/virtual-keyboard.h b/backends/vkeybd/virtual-keyboard.h index 2c31afcb35..66f5f8b4ea 100644 --- a/backends/vkeybd/virtual-keyboard.h +++ b/backends/vkeybd/virtual-keyboard.h @@ -121,7 +121,13 @@ protected: OverlayColor displayFontColor; Mode() : image(0) {} - ~Mode() { delete image; } + ~Mode() { + if (image) { + image->free(); + delete image; + image = 0; + } + } }; typedef HashMap<String, Mode, IgnoreCase_Hash, IgnoreCase_EqualTo> ModeMap; |