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

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Feb 17 16:58:29 PST 2013


 lotuswordpro/source/filter/lwpbulletstylemgr.cxx |    2 ++
 lotuswordpro/source/filter/lwpcelllayout.cxx     |    6 ++----
 lotuswordpro/source/filter/lwplayout.cxx         |   16 ++++++++--------
 lotuswordpro/source/filter/lwprowlayout.cxx      |   20 +++++++++-----------
 lotuswordpro/source/filter/lwptablelayout.cxx    |    2 +-
 5 files changed, 22 insertions(+), 24 deletions(-)

New commits:
commit fdf59cc3b5928aa1b4fca62909988c455695cd03
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:40:13 2013 +0100

    coverity: fix memory leak
    
    Change-Id: Ibe595adf52c6880ce4ecdb469b89074fcdc0c16b

diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index ec05975..9c8941e 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -266,7 +266,7 @@ double LwpSuperTableLayout::GetTableWidth()
 void LwpSuperTableLayout::ApplyShadow(XFTableStyle *pTableStyle)
 {
     // use shadow property of supertable
-    XFShadow* pXFShadow = GetXFShadow();
+    boost::scoped_ptr<XFShadow> pXFShadow(GetXFShadow());
     if(pXFShadow)
     {
         pTableStyle->SetShadow(pXFShadow->GetPosition(), pXFShadow->GetOffset(), pXFShadow->GetColor());
commit 7511f631775365ec4477e98852a7f6df2bca333a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:37:19 2013 +0100

    coverity: fix memory leak
    
    Change-Id: I991f0e90abfa6e772f43afd8b8aa69d3b5ce4fa0

diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index 1c162f8..3c544ee 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -177,14 +177,11 @@ void LwpRowLayout::Read()
  */
 void LwpRowLayout::ConvertRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uInt8 nEndCol)
 {
-    XFRow* pXFRow = new XFRow;
-
     LwpTableLayout* pTableLayout = GetParentTableLayout();
     LwpTable* pTable = pTableLayout->GetTable();
 
     //calculate the connected cell position
-    sal_Int32 nMarkConnCell;
-    nMarkConnCell = FindMarkConnCell(nStartCol,nEndCol);
+    sal_Int32 nMarkConnCell = FindMarkConnCell(nStartCol,nEndCol);
 
     //if there is no connected cell
     if (nMarkConnCell == -1)
@@ -195,6 +192,7 @@ void LwpRowLayout::ConvertRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uInt8 nE
 
     //register connect row style
     sal_uInt16 nRowMark = crowid + GetCurMaxSpannedRows(nStartCol,nEndCol);
+    XFRow* pXFRow = new XFRow;
     RegisterCurRowStyle(pXFRow,nRowMark);
 
     //if there is connected cell
commit 856a3a09a06fef903ce09d385a97205fdf9308fe
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:35:05 2013 +0100

    coverity: fix memory leak
    
    Change-Id: I12ad99f3179ee8ef9e0322823685eb2bf337fc22

diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx
index f21114c..1c162f8 100644
--- a/lotuswordpro/source/filter/lwprowlayout.cxx
+++ b/lotuswordpro/source/filter/lwprowlayout.cxx
@@ -248,25 +248,25 @@ void LwpRowLayout::ConvertRow(XFTable* pXFTable,sal_uInt8 nStartCol,sal_uInt8 nE
  */
 void LwpRowLayout::RegisterCurRowStyle(XFRow* pXFRow,sal_uInt16 nRowMark)
 {
-    XFRowStyle* pRowStyle;
-    XFRowStyle* pNewStyle = new XFRowStyle;
-    double fHeight;
     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
-    pRowStyle = static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(m_StyleName));
+    XFRowStyle* pRowStyle = static_cast<XFRowStyle*>(pXFStyleManager->FindStyle(m_StyleName));
     if (!pRowStyle)
         return;
-    fHeight = pRowStyle->GetRowHeight();
+    double fHeight = pRowStyle->GetRowHeight();
 
+    XFRowStyle* pNewStyle = new XFRowStyle;
     *pNewStyle = *pRowStyle;
-    std::map<sal_uInt16,LwpRowLayout*>::iterator iter;
     LwpTableLayout* pTableLayout = GetParentTableLayout();
     if (!pTableLayout)
+    {
+        delete pNewStyle;
         return;
+    }
     std::map<sal_uInt16,LwpRowLayout*> RowsMap = pTableLayout->GetRowsMap();
 
     for (sal_uInt16 i=crowid+1; i<nRowMark;i++)
     {
-        iter = RowsMap.find(i);
+        std::map<sal_uInt16,LwpRowLayout*>::iterator iter = RowsMap.find(i);
         if (iter == RowsMap.end())
         {
             pRowStyle = static_cast<XFRowStyle*>(
commit 655c7b5260e2618d0115f1437f0a96b2a9490f09
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:30:44 2013 +0100

    coverity: fix memory leak
    
    Change-Id: I9fa99a3f2a5de644961cbf8b9951e1c1246d97cb

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 918b74e..ca36718 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1589,7 +1589,7 @@ XFColumns* LwpLayout::GetXFColumns()
 
     XFColumns* pColumns = new XFColumns();
     //set XFColumnSep
-    XFColumnSep* pColumnSep = GetColumnSep();
+    boost::scoped_ptr<XFColumnSep> pColumnSep(GetColumnSep());
     if(pColumnSep)
     {
         pColumns->SetSeperator(*pColumnSep);
commit e94d1bb9283aa59134833eae768a47210599eaa7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:28:44 2013 +0100

    coverity: no need to use a pointer here
    
    Change-Id: I83b986c6f2f8670c2c0f6caa754fd3567c7488a8

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index b2333e0..918b74e 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1603,24 +1603,24 @@ XFColumns* LwpLayout::GetXFColumns()
     //set xfcolumn
     for(sal_uInt16 nIndex = 0; nIndex<nCols; nIndex++)
     {
-        XFColumn* pColumn = new XFColumn();
+        XFColumn aColumn;
         sal_Int32 nWidth = static_cast<sal_Int32>(GetColWidth(nIndex));
         nWidth=8305/nCols;  //relative width
-        pColumn->SetRelWidth(nWidth);
+        aColumn.SetRelWidth(nWidth);
 
         //the left and right margins is 0;
         double nGap = GetColGap(nIndex)/2;
         //nGap=0;
-        pColumn->SetMargins(nGap,nGap);
+        aColumn.SetMargins(nGap,nGap);
         if(nIndex==0)
         {
-            pColumn->SetMargins(0,nGap);
+            aColumn.SetMargins(0,nGap);
         }
         if(nIndex==(nCols-1))
         {
-            pColumn->SetMargins(nGap,0);
+            aColumn.SetMargins(nGap,0);
         }
-        pColumns->AddColumn(*pColumn);
+        pColumns->AddColumn(aColumn);
     }
 
     return pColumns;
commit ae3138859ef193ee0c297c2a97026923abb43cd2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:26:17 2013 +0100

    coverity: new[] vs delete mismatch
    
    Change-Id: Ic10d900b092c37ee627d3911200ebd29106cc360

diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx
index 1c646f9..b2333e0 100644
--- a/lotuswordpro/source/filter/lwplayout.cxx
+++ b/lotuswordpro/source/filter/lwplayout.cxx
@@ -1392,7 +1392,7 @@ XFBGImage* LwpMiddleLayout::GetXFBGImage()
                 pXFBGImage->SetImageData(pGrafData, nDataLen);
                 if(pGrafData)
                 {
-                    delete pGrafData;
+                    delete[] pGrafData;
                     pGrafData = NULL;
                 }
             }
commit 7ae107542c62d6676132a89ae5519e70132f02d3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:21:54 2013 +0100

    coverity: fix memory leak
    
    Change-Id: Iaa27244b1829bfe5a26c9352da6a8819d3037ccd

diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index fd1cfcf..45835f0 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -769,7 +769,7 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
             LwpCellLayout * pBelowNeighbour = GetCellByRowCol(nRow + nRowSpan, nCol+iLoop, pTableLayout);
             if (pBelowNeighbour)
             {
-                XFBorders * pBelowBorders = pBelowNeighbour->GetXFBorders();
+                boost::scoped_ptr<XFBorders> pBelowBorders(pBelowNeighbour->GetXFBorders());
                 if (pBelowBorders)
                 {
                     XFBorder * pTopBorder = pBelowBorders->GetTop();
@@ -780,7 +780,6 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
                         bNoBottomBorder = sal_False;
                         break;
                     }
-                    delete pBelowBorders;
                 }
             }
         }
commit 57d89a758ad5695df4cc492ccb6a97d5cbaf30b3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:20:59 2013 +0100

    coverity: fix memory leak
    
    Change-Id: I4f31cd0848e8a521bcbcb97fc1abad159745a501

diff --git a/lotuswordpro/source/filter/lwpcelllayout.cxx b/lotuswordpro/source/filter/lwpcelllayout.cxx
index 8112069..fd1cfcf 100644
--- a/lotuswordpro/source/filter/lwpcelllayout.cxx
+++ b/lotuswordpro/source/filter/lwpcelllayout.cxx
@@ -742,7 +742,7 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
             LwpCellLayout * pLeftNeighbour = GetCellByRowCol(nRow+iLoop, GetLeftColID(nCol), pTableLayout);
             if (pLeftNeighbour)
             {
-                XFBorders * pNeighbourBorders = pLeftNeighbour->GetXFBorders();
+                boost::scoped_ptr<XFBorders> pNeighbourBorders(pLeftNeighbour->GetXFBorders());
                 if (pNeighbourBorders)
                 {
                     XFBorder * pRightBorder = pNeighbourBorders->GetRight();
@@ -753,7 +753,6 @@ LwpCellBorderType LwpConnectedCellLayout::GetCellBorderType(sal_uInt16 nRow, sal
                         bNoLeftBorder = sal_False;
                         break;
                     }
-                    delete pNeighbourBorders;
                 }
             }
         }
commit 0bb0c37820b255cb00c8e2637368f43566b65779
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Mon Feb 18 01:18:20 2013 +0100

    coverity: fix memory leak
    
    Change-Id: If25fd29f4788af37b4ff8ef95568751ddf176f51

diff --git a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
index 78fa738..25bdbea 100644
--- a/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
+++ b/lotuswordpro/source/filter/lwpbulletstylemgr.cxx
@@ -239,6 +239,8 @@ rtl::OUString LwpBulletStyleMgr::RegisterBulletStyle(LwpPara* pPara, LwpBulletOv
             }
             aStyleName = pXFStyleMgr->AddStyle(pListStyle)->GetStyleName();
         }
+        else
+            delete pListStyle;
 
     }
 


More information about the Libreoffice-commits mailing list