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/source | |
parent | 327701f66251dc56933727cf9a9febc79f4dc8c0 (diff) |
CID#735395 potential memory leak
Change-Id: Ica07e23920d751757ab5d14d5216615d5fcdbfd9
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/caret.cxx | 3 | ||||
-rw-r--r-- | starmath/source/cursor.cxx | 3 | ||||
-rw-r--r-- | starmath/source/visitors.cxx | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/starmath/source/caret.cxx b/starmath/source/caret.cxx index 524ae9efa240..9f9e8f6abc51 100644 --- a/starmath/source/caret.cxx +++ b/starmath/source/caret.cxx @@ -39,8 +39,7 @@ SmCaretPosGraphEntry* SmCaretPosGraph::Add(SmCaretPosGraphEntry entry){ } SmCaretPosGraph::~SmCaretPosGraph(){ - if(pNext) - delete pNext; + delete pNext; pNext = NULL; } diff --git a/starmath/source/cursor.cxx b/starmath/source/cursor.cxx index 81b1f597324d..e00ca8109d27 100644 --- a/starmath/source/cursor.cxx +++ b/starmath/source/cursor.cxx @@ -120,10 +120,9 @@ void SmCursor::BuildGraph(){ anchor = NULL; position = NULL; } - pGraph = NULL; //Build the new graph - pGraph = SmCaretPosGraphBuildingVisitor(pTree).Graph(); + pGraph = SmCaretPosGraphBuildingVisitor(pTree).takeGraph(); //Restore anchor and position pointers if(_anchor.IsValid() || _position.IsValid()){ diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx index 941739c6fffa..93ea409dde1f 100644 --- a/starmath/source/visitors.cxx +++ b/starmath/source/visitors.cxx @@ -990,6 +990,11 @@ SmCaretPosGraphBuildingVisitor::SmCaretPosGraphBuildingVisitor( SmNode* pRootNod pRootNode->Accept(this); } +SmCaretPosGraphBuildingVisitor::~SmCaretPosGraphBuildingVisitor() +{ + delete pGraph; +} + void SmCaretPosGraphBuildingVisitor::Visit( SmLineNode* pNode ){ SmNodeIterator it( pNode ); while( it.Next( ) ){ |