[Libreoffice-commits] .: sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Mar 16 21:07:46 PDT 2012


 sc/source/filter/xml/xmldpimp.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 3ae3f098ed4e6495c0be0748dacf03dd8e0fe091
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Sat Mar 17 00:07:33 2012 -0400

    Fixed potential memory leak & UniString removal.

diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx
index ee8e3aa..8fa7312 100644
--- a/sc/source/filter/xml/xmldpimp.cxx
+++ b/sc/source/filter/xml/xmldpimp.cxx
@@ -1037,11 +1037,14 @@ SvXMLImportContext *ScXMLDataPilotFieldContext::CreateChildContext( sal_uInt16 n
 void ScXMLDataPilotFieldContext::AddMember(ScDPSaveMember* pMember)
 {
     if (pDim)
+    {
         pDim->AddMember(pMember);
-
-    if (!pMember->GetIsVisible())
-        // This member is hidden.
-        mbHasHiddenMember = true;
+        if (!pMember->GetIsVisible())
+            // This member is hidden.
+            mbHasHiddenMember = true;
+    }
+    else
+        delete pMember;
 }
 
 void ScXMLDataPilotFieldContext::SetSubTotalName(const OUString& rName)
@@ -1636,7 +1639,7 @@ void ScXMLDataPilotMemberContext::EndElement()
 {
     if (bHasName)   // #i53407# don't check sName, empty name is allowed
     {
-        ScDPSaveMember* pMember = new ScDPSaveMember(String(sName));
+        ScDPSaveMember* pMember = new ScDPSaveMember(sName);
         if (!maDisplayName.isEmpty())
             pMember->SetLayoutName(maDisplayName);
         pMember->SetIsVisible(bDisplay);


More information about the Libreoffice-commits mailing list