[Libreoffice-commits] core.git: starmath/source

Caolán McNamara caolanm at redhat.com
Sat Dec 2 11:56:29 UTC 2017


 starmath/source/mathmlimport.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 5a075c693c9256c531220cd206cd9a5ef560ae48
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Dec 1 17:33:20 2017 +0000

    ofz: mem leak
    
    Change-Id: I4dc4ff6b2c4bdbcc2c705651a85886441ad90e64
    Reviewed-on: https://gerrit.libreoffice.org/45692
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx
index 2147001061de..04ccf8bd9e6e 100644
--- a/starmath/source/mathmlimport.cxx
+++ b/starmath/source/mathmlimport.cxx
@@ -2638,10 +2638,9 @@ void SmXMLTableContext_Impl::EndElement()
     auto nRows = rNodeStack.size()-nElementCount;
     sal_uInt16 nCols = 0;
 
-    SmStructureNode *pArray;
     for (auto i=nRows;i > 0;i--)
     {
-        pArray = static_cast<SmStructureNode *>(rNodeStack.front().release());
+        SmStructureNode* pArray = static_cast<SmStructureNode *>(rNodeStack.front().release());
         rNodeStack.pop_front();
         if (pArray->GetNumSubNodes() == 0)
         {
@@ -2669,10 +2668,11 @@ void SmXMLTableContext_Impl::EndElement()
     size_t j=0;
     while ( !aReverseStack.empty() )
     {
-        pArray = static_cast<SmStructureNode *>(aReverseStack.front().release());
+        std::unique_ptr<SmStructureNode> xArray(static_cast<SmStructureNode*>(aReverseStack.front().release()));
         aReverseStack.pop_front();
-        for (sal_uInt16 i=0;i<pArray->GetNumSubNodes();i++)
-            aExpressionArray[j++] = pArray->GetSubNode(i);
+        for (sal_uInt16 i = 0; i < xArray->GetNumSubNodes(); ++i)
+            aExpressionArray[j++] = xArray->GetSubNode(i);
+        xArray->SetSubNodes(SmNodeArray());
     }
 
     SmToken aToken;


More information about the Libreoffice-commits mailing list