diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-10-03 11:17:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-03 13:09:21 +0100 |
commit | 6e132589cb9095530662f5d71f5d78dfc8962d5b (patch) | |
tree | 2ca68dbccdcaa7e4a605ccdae99ab84cf44eb103 /starmath/inc | |
parent | 327701f66251dc56933727cf9a9febc79f4dc8c0 (diff) |
CID#735395 potential memory leak
Change-Id: Ica07e23920d751757ab5d14d5216615d5fcdbfd9
Diffstat (limited to 'starmath/inc')
-rw-r--r-- | starmath/inc/cursor.hxx | 3 | ||||
-rw-r--r-- | starmath/inc/visitors.hxx | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/starmath/inc/cursor.hxx b/starmath/inc/cursor.hxx index 9f15e05ec985..82c98e43fb1f 100644 --- a/starmath/inc/cursor.hxx +++ b/starmath/inc/cursor.hxx @@ -90,8 +90,7 @@ public: ~SmCursor(){ SetClipboard(); - if(pGraph) - delete pGraph; + delete pGraph; pGraph = NULL; } diff --git a/starmath/inc/visitors.hxx b/starmath/inc/visitors.hxx index 3e74c533fa54..7d452237f424 100644 --- a/starmath/inc/visitors.hxx +++ b/starmath/inc/visitors.hxx @@ -318,7 +318,7 @@ class SmCaretPosGraphBuildingVisitor : public SmVisitor public: /** Builds a caret position graph for pRootNode */ SmCaretPosGraphBuildingVisitor( SmNode* pRootNode ); - virtual ~SmCaretPosGraphBuildingVisitor() {} + virtual ~SmCaretPosGraphBuildingVisitor(); void Visit( SmTableNode* pNode ); void Visit( SmBraceNode* pNode ); void Visit( SmBracebodyNode* pNode ); @@ -346,8 +346,11 @@ public: void Visit( SmRootSymbolNode* pNode ); void Visit( SmRectangleNode* pNode ); void Visit( SmVerticalBraceNode* pNode ); - SmCaretPosGraph* Graph( ){ - return pGraph; + SmCaretPosGraph* takeGraph() + { + SmCaretPosGraph *pRet = pGraph; + pGraph = 0; + return pRet; } private: SmCaretPosGraphEntry* pRightMost; |