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

Caolán McNamara caolanm at redhat.com
Thu Jul 6 13:15:11 UTC 2017


 sw/source/filter/ww8/ww8par.cxx  |    5 ++---
 sw/source/filter/ww8/ww8par.hxx  |    2 +-
 sw/source/filter/ww8/ww8par2.cxx |    2 +-
 sw/source/filter/ww8/ww8par5.cxx |    4 ++--
 sw/source/filter/ww8/ww8par6.cxx |    2 +-
 5 files changed, 7 insertions(+), 8 deletions(-)

New commits:
commit d44f8bd5524944c56d748028c83a6d4fa8ff0fa4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 6 10:07:28 2017 +0100

    ofz: fix some leaks
    
    Change-Id: I6c4706e203f82d692630b4953e48050c71235d16
    Reviewed-on: https://gerrit.libreoffice.org/39634
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index f3f468fca999..d1ef61ae9c4e 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4142,7 +4142,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
     , m_pPrevNumRule(nullptr)
     , m_pPostProcessAttrsInfo(nullptr)
     , m_pWwFib(nullptr)
-    , m_pFonts(nullptr)
     , m_pWDop(nullptr)
     , m_pLstManager(nullptr)
     , m_pSBase(nullptr)
@@ -4947,7 +4946,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
     ::StartProgress(STR_STATSTR_W4WREAD, 0, 100, m_pDocShell);
 
     // read Font Table
-    m_pFonts = new WW8Fonts( *m_pTableStream, *m_pWwFib );
+    m_xFonts.reset(new WW8Fonts(*m_pTableStream, *m_pWwFib));
 
     // Document Properties
     m_pWDop = new WW8Dop( *m_pTableStream, m_pWwFib->m_nFib, m_pWwFib->m_fcDop,
@@ -5248,7 +5247,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss)
     m_xHdFt.reset();
     DELETEZ( m_pSBase );
     delete m_pWDop;
-    DELETEZ( m_pFonts );
+    m_xFonts.reset();
     delete m_pAtnNames;
     m_xSprmParser.reset();
     ::EndProgress(m_pDocShell);
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 1cd272dcf491..448bd152381c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1194,7 +1194,7 @@ private:
     WW8PostProcessAttrsInfo * m_pPostProcessAttrsInfo;
 
     WW8Fib* m_pWwFib;
-    WW8Fonts* m_pFonts;
+    std::unique_ptr<WW8Fonts> m_xFonts;
     WW8Dop* m_pWDop;
     WW8ListManager* m_pLstManager;
     WW8ScannerBase* m_pSBase;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index eb9d7151d4db..8cda8394a965 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -730,7 +730,7 @@ void SwWW8ImplReader::SetAnlvStrings(SwNumFormat &rNum, WW8_ANLV const &rAV,
     bool bInsert = false;                       // Default
     rtl_TextEncoding eCharSet = m_eStructCharSet;
 
-    const WW8_FFN* pF = m_pFonts->GetFont(SVBT16ToShort(rAV.ftc)); // FontInfo
+    const WW8_FFN* pF = m_xFonts->GetFont(SVBT16ToShort(rAV.ftc)); // FontInfo
     bool bListSymbol = pF && ( pF->chs == 2 );      // Symbol/WingDings/...
 
     OUString sText;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 184c4d9523b7..e982db6f8b9b 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2273,7 +2273,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
     {
         //set Wingdings font
         sal_uInt16 i = 0;
-        for ( ; i < m_pFonts->GetMax(); i++ )
+        for ( ; i < m_xFonts->GetMax(); i++ )
         {
             FontFamily eFamily;
             OUString aFontName;
@@ -2286,7 +2286,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr)
             }
         }
 
-        if ( i < m_pFonts->GetMax() )
+        if ( i < m_xFonts->GetMax() )
         {
 
             SetNewFontAttr( i, true, RES_CHRATR_FONT );
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index d79260709827..2e02896b2c6f 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3531,7 +3531,7 @@ bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily,
         FAMILY_SCRIPT, FAMILY_DECORATIVE, FAMILY_DONTKNOW, FAMILY_DONTKNOW
     };
 
-    const WW8_FFN* pF = m_pFonts->GetFont( nFCode );  // Info for it
+    const WW8_FFN* pF = m_xFonts->GetFont( nFCode );  // Info for it
     if( !pF )                                   // font number unknown ?
         return false;                           // then ignore
 


More information about the Libreoffice-commits mailing list