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

Caolán McNamara caolanm at redhat.com
Sun Jan 14 20:49:41 UTC 2018


 lotuswordpro/source/filter/lwpbulletstylemgr.cxx |   13 ++++++-------
 lotuswordpro/source/filter/lwpbulletstylemgr.hxx |    2 +-
 lotuswordpro/source/filter/lwpfribptr.cxx        |    8 ++++----
 lotuswordpro/source/filter/lwppara.cxx           |   10 +++++-----
 lotuswordpro/source/filter/lwppara.hxx           |    2 +-
 5 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit 594a21fd5e13bc4626e22bf06d85822d6de9eebf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Jan 14 20:48:50 2018 +0000

    ofz#5301 Direct-leak
    
    Change-Id: Id9b876e89dd186782c0168229840f721a8b3720c

diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 9692eedb7fa3..4b97c6551e6e 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -110,7 +110,7 @@ OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverrid
     LwpPara* pBulletPara = pSilverBullet->GetBulletPara();
     if (!pBulletPara)
     {
-        assert(false);
+        SAL_WARN("lwp", "missing bullet para");
         return OUString();
     }
 
@@ -245,7 +245,7 @@ OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOverrid
 
 //Create nested XFList and XFItems and then add it to XFContentContainer(pCont)
 //Return the inner XFItem created.
-XFContentContainer* LwpBulletStyleMgr::AddBulletList(
+rtl::Reference<XFContentContainer> LwpBulletStyleMgr::AddBulletList(
         XFContentContainer* pCont, bool bIsOrdered,
         const OUString& rStyleName, sal_Int16 nLevel, bool bIsBulletSkiped)
 {
@@ -256,13 +256,12 @@ XFContentContainer* LwpBulletStyleMgr::AddBulletList(
     //todo: need judge here.
     bool bContinue = m_bContinue;
 
-    XFList* theList;
-    XFList* prevList = nullptr;
+    rtl::Reference<XFList> prevList;
     XFListItem* theItem;
     XFListItem* InnerItem = nullptr;
     for (sal_Int8 nC = nLevel-1; nC >= 0; nC--)
     {
-        theList = new XFList();
+        rtl::Reference<XFList> theList(new XFList);
         theItem = new XFListItem();
         theList->Add(theItem);
 
@@ -284,7 +283,7 @@ XFContentContainer* LwpBulletStyleMgr::AddBulletList(
         if (nC == 0 && pCont)
         {
             theList->SetStyleName(rStyleName);
-            pCont->Add(theList);
+            pCont->Add(theList.get());
         }
 
         if ((nC == nLevel-1) && bIsBulletSkiped)
@@ -301,7 +300,7 @@ XFContentContainer* LwpBulletStyleMgr::AddBulletList(
 
         if(prevList)
         {
-            theItem->Add(prevList);
+            theItem->Add(prevList.get());
         }
         prevList = theList;
     }
diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
index 7dce7eb165c6..78754a75b355 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.hxx
@@ -84,7 +84,7 @@ public:
         LwpIndentOverride const * pIndent);
     inline void SetFoundry(LwpFoundry* pFoundry);
     inline void SetContinueFlag(bool bFlag);
-    XFContentContainer* AddBulletList(XFContentContainer* pCont, bool bIsOrdered,
+    rtl::Reference<XFContentContainer> AddBulletList(XFContentContainer* pCont, bool bIsOrdered,
         const OUString& rStyleName, sal_Int16 nLevel, bool bIsBulletSkiped);
     inline void SetCurrentSilverBullet(const LwpObjectID& rNewID);
 
diff --git a/lotuswordpro/source/filter/lwpfribptr.cxx b/lotuswordpro/source/filter/lwpfribptr.cxx
index d56f0aba06ed..0cad23dfbe2f 100644
--- a/lotuswordpro/source/filter/lwpfribptr.cxx
+++ b/lotuswordpro/source/filter/lwpfribptr.cxx
@@ -240,10 +240,10 @@ void LwpFribPtr::XFConvert()
             break;
         case FRIB_TAG_COLBREAK:
         {
-            XFParagraph *pPara = new XFParagraph();
-            pPara->SetStyleName(pFrib->GetStyleName());
-            SetXFPara(pPara);
-            m_pPara->AddXFContent(pPara);
+            rtl::Reference<XFParagraph> xPara(new XFParagraph);
+            xPara->SetStyleName(pFrib->GetStyleName());
+            SetXFPara(xPara.get());
+            m_pPara->AddXFContent(xPara.get());
         }
             break;
         case FRIB_TAG_LINEBREAK:
diff --git a/lotuswordpro/source/filter/lwppara.cxx b/lotuswordpro/source/filter/lwppara.cxx
index af39a79bea70..0c9c59d6fd2d 100644
--- a/lotuswordpro/source/filter/lwppara.cxx
+++ b/lotuswordpro/source/filter/lwppara.cxx
@@ -278,10 +278,10 @@ void LwpPara::XFConvert(XFContentContainer* pCont)
 
     if (m_bHasBullet && m_pSilverBullet)
     {
-        XFContentContainer* pListItem = AddBulletList(m_pXFContainer);
-        if (pListItem)
+        rtl::Reference<XFContentContainer> xListItem = AddBulletList(m_pXFContainer);
+        if (xListItem)
         {
-            pListItem->Add(pPara);
+            xListItem->Add(pPara);
         }
     }
     else if (m_pXFContainer)
@@ -879,13 +879,13 @@ LwpBulletStyleMgr* LwpPara::GetBulletStyleMgr()
     return nullptr;
 }
 
-XFContentContainer* LwpPara::AddBulletList(XFContentContainer* pCont)
+rtl::Reference<XFContentContainer> LwpPara::AddBulletList(XFContentContainer* pCont)
 {
     LwpBulletStyleMgr* pBulletStyleMgr = GetBulletStyleMgr();
     if (!pBulletStyleMgr)
     {
         assert(false);
-        return nullptr;
+        return rtl::Reference<XFContentContainer>();
     }
 
     sal_uInt16 nLevel = m_nLevel;
diff --git a/lotuswordpro/source/filter/lwppara.hxx b/lotuswordpro/source/filter/lwppara.hxx
index da927326c24e..2b662ea75204 100644
--- a/lotuswordpro/source/filter/lwppara.hxx
+++ b/lotuswordpro/source/filter/lwppara.hxx
@@ -271,7 +271,7 @@ private:
     void RegisterNewSectionStyle(LwpPageLayout* pLayout);
 
     void ParseDropcapContent();
-    XFContentContainer* AddBulletList(XFContentContainer* pCont);
+    rtl::Reference<XFContentContainer> AddBulletList(XFContentContainer* pCont);
     void AddBreakAfter(XFContentContainer* pCont);
     void AddBreakBefore(XFContentContainer* pCont);
     XFSection* CreateXFSection();


More information about the Libreoffice-commits mailing list