[Libreoffice-commits] core.git: svtools/source sw/source

Caolán McNamara caolanm at redhat.com
Tue Jul 9 04:46:04 PDT 2013


 svtools/source/control/ctrltool.cxx |    3 +--
 sw/source/ui/config/optpage.cxx     |   12 ++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 40df5fc0e30c0aa32157c645db8b5256dc8afcc3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jul 9 12:34:12 2013 +0100

    mem leaks in writer font options tabpage
    
    Change-Id: I7378f1a230fc55a97bc06d154939502f6ddcc792

diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 9119102..0684d9b 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -382,8 +382,7 @@ FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, sal_Bool bAll
 FontList::~FontList()
 {
     // Gegebenenfalls SizeArray loeschen
-    if ( mpSizeAry )
-        delete[] mpSizeAry;
+    delete[] mpSizeAry;
 
     // FontInfos loeschen
     ImplFontListFontInfo *pTemp, *pInfo;
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index c1782d4..4aef2e1 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -578,8 +578,11 @@ SwStdFontTabPage::SwStdFontTabPage( Window* pParent,
 
 SwStdFontTabPage::~SwStdFontTabPage()
 {
-    if(bDeletePrinter)
+    delete pFontList;
+    if (bDeletePrinter)
+    {
         delete pPrt;
+    }
 }
 
 SfxTabPage* SwStdFontTabPage::Create( Window* pParent,
@@ -760,6 +763,11 @@ void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
 
     const SfxPoolItem* pItem;
 
+    if (bDeletePrinter)
+    {
+        delete pPrt;
+    }
+
     if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_PRINTER, sal_False, &pItem))
     {
         pPrt = (SfxPrinter*)((const SwPtrItem*)pItem)->GetValue();
@@ -771,8 +779,8 @@ void SwStdFontTabPage::Reset( const SfxItemSet& rSet)
                     SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
                     0 );
         pPrt = new SfxPrinter(pPrinterSet);
-        bDeletePrinter = sal_True;
     }
+    delete pFontList;
     pFontList = new FontList( pPrt );
     // #i94536# prevent duplication of font entries when 'reset' button is pressed
     if( !pStandardBox->GetEntryCount() )


More information about the Libreoffice-commits mailing list