]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Fixes small memory leak in DolphinContextMenu
authorDavid Hallas <david@davidhallas.dk>
Wed, 18 Jul 2018 22:43:25 +0000 (16:43 -0600)
committerNathaniel Graham <nate@kde.org>
Wed, 18 Jul 2018 22:48:07 +0000 (16:48 -0600)
Summary: When DolphinContextMenu::baseFileItem is called a KFileItem is allocated and stored in DolphinContextMenu::m_baseFileItem, which is of type KFileItem*, but the destructor failed to delete this.

Test Plan: This leak was found using Address Sanitizer

Reviewers: broulik, elvisangelaccio

Reviewed By: broulik, elvisangelaccio

Subscribers: ngraham, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D14178

src/dolphincontextmenu.cpp

index 7d7d7a40843f4b77d741e50bb10d601fe2f58e05..8fdaab1d0e17ecb5ed2bd6748dbb288c5136d116 100644 (file)
@@ -81,6 +81,8 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
 
 DolphinContextMenu::~DolphinContextMenu()
 {
 
 DolphinContextMenu::~DolphinContextMenu()
 {
+    delete m_baseFileItem;
+    m_baseFileItem = nullptr;
     delete m_selectedItemsProperties;
     m_selectedItemsProperties = nullptr;
 }
     delete m_selectedItemsProperties;
     m_selectedItemsProperties = nullptr;
 }