From 4d897e182412dbd26cc2221e4f3ddf8c1dceaf2e Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 17 Nov 2016 09:56:44 -0300 Subject: [PATCH] Fix memory leaks on KeyboardShortcutsCommand --- src/app/commands/cmd_keyboard_shortcuts.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_keyboard_shortcuts.cpp b/src/app/commands/cmd_keyboard_shortcuts.cpp index 53ca073de..076f5e5a9 100644 --- a/src/app/commands/cmd_keyboard_shortcuts.cpp +++ b/src/app/commands/cmd_keyboard_shortcuts.cpp @@ -62,7 +62,7 @@ public: KeyItem(const std::string& text, Key* key, AppMenuItem* menuitem, int level) : ListItem(text) , m_key(key) - , m_keyOrig(key ? new Key(*key): NULL) + , m_keyOrig(key ? new Key(*key): nullptr) , m_menuitem(menuitem) , m_level(level) , m_hotAccel(-1) @@ -73,6 +73,10 @@ public: setBorder(border); } + ~KeyItem() { + delete m_keyOrig; + } + Key* key() { return m_key; } AppMenuItem* menuitem() const { return m_menuitem; }