[Libreoffice-commits] core.git: filter/source include/filter sd/source
Caolán McNamara
caolanm at redhat.com
Thu Jan 4 21:04:13 UTC 2018
filter/source/msfilter/svdfppt.cxx | 24 +++++++++++-------------
include/filter/msfilter/svdfppt.hxx | 2 +-
sd/source/filter/ppt/pptin.cxx | 4 ++--
3 files changed, 14 insertions(+), 16 deletions(-)
New commits:
commit e26f2f3367d6bd44fda9a4c5ca2faeb7359bcb97
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Jan 4 09:50:53 2018 +0000
ofz#4943 Direct-leak
Change-Id: I45b7c6befadda58d7919732597647b9e2cbd46d8
Reviewed-on: https://gerrit.libreoffice.org/47373
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index da92297ebd5b..7f5e7a024e36 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -500,7 +500,6 @@ SvStream& ReadPptOEPlaceholderAtom( SvStream& rIn, PptOEPlaceholderAtom& rAtom )
PptSlidePersistEntry::PptSlidePersistEntry() :
pStyleSheet ( nullptr ),
- pHeaderFooterEntry ( nullptr ),
pSolverContainer ( nullptr ),
nSlidePersistStartOffset( 0 ),
nSlidePersistEndOffset ( 0 ),
@@ -520,7 +519,6 @@ PptSlidePersistEntry::PptSlidePersistEntry() :
PptSlidePersistEntry::~PptSlidePersistEntry()
{
delete pStyleSheet;
- delete pHeaderFooterEntry;
delete pSolverContainer;
};
@@ -1634,9 +1632,9 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
for (size_t i = 0; i < m_pMasterPages->size(); i++)
{
if ((*m_pMasterPages)[ i ].bNotesMaster)
- (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNotesMaster );
+ (*m_pMasterPages)[ i ].xHeaderFooterEntry.reset(new HeaderFooterEntry(aNotesMaster));
else
- (*m_pMasterPages)[ i ].pHeaderFooterEntry = new HeaderFooterEntry( aNormalMaster );
+ (*m_pMasterPages)[ i ].xHeaderFooterEntry.reset(new HeaderFooterEntry(aNormalMaster));
}
}
}
@@ -2744,7 +2742,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
DffRecordHeader aPageHd;
if ( SeekToAktPage( &aPageHd ) )
{
- rSlidePersist.pHeaderFooterEntry = new HeaderFooterEntry( pMasterPersist );
+ rSlidePersist.xHeaderFooterEntry.reset(new HeaderFooterEntry(pMasterPersist));
ProcessData aProcessData( rSlidePersist, SdPageCapsule(pRet) );
auto nEndRecPos = SanitizeEndPos(rStCtrl, aPageHd.GetRecEndFilePos());
while ( ( rStCtrl.GetError() == ERRCODE_NONE ) && ( rStCtrl.Tell() < nEndRecPos ) )
@@ -2755,7 +2753,7 @@ void SdrPowerPointImport::ImportPage( SdrPage* pRet, const PptSlidePersistEntry*
{
case PPT_PST_HeadersFooters :
{
- ImportHeaderFooterContainer( aHd, *rSlidePersist.pHeaderFooterEntry );
+ ImportHeaderFooterContainer(aHd, *rSlidePersist.xHeaderFooterEntry);
}
break;
@@ -3079,10 +3077,10 @@ HeaderFooterEntry::HeaderFooterEntry( const PptSlidePersistEntry* pMPE ) :
{
if ( pMPE )
{
- HeaderFooterEntry* pMHFE = pMPE->pHeaderFooterEntry;
+ HeaderFooterEntry* pMHFE = pMPE->xHeaderFooterEntry.get();
if ( pMHFE )
{
- nAtom = pMPE->pHeaderFooterEntry->nAtom;
+ nAtom = pMPE->xHeaderFooterEntry->nAtom;
pPlaceholder[ 0 ] = pMHFE->pPlaceholder[ 0 ];
pPlaceholder[ 1 ] = pMHFE->pPlaceholder[ 1 ];
pPlaceholder[ 2 ] = pMHFE->pPlaceholder[ 2 ];
@@ -6783,12 +6781,12 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
xEntry.reset(new PPTFieldEntry);
rIn.ReadUInt16(xEntry->nPos);
xEntry->xField1.reset(new SvxFieldItem(SvxDateTimeField(), EE_FEATURE_FIELD));
- if ( rPersistEntry.pHeaderFooterEntry ) // sj: #i34111# on master pages it is possible
- { // that there is no HeaderFooterEntry available
- if ( rPersistEntry.pHeaderFooterEntry->nAtom & 0x20000 ) // auto date time
- xEntry->SetDateTime( rPersistEntry.pHeaderFooterEntry->nAtom & 0xff );
+ if (rPersistEntry.xHeaderFooterEntry) // sj: #i34111# on master pages it is possible
+ { // that there is no HeaderFooterEntry available
+ if (rPersistEntry.xHeaderFooterEntry->nAtom & 0x20000) // auto date time
+ xEntry->SetDateTime(rPersistEntry.xHeaderFooterEntry->nAtom & 0xff);
else
- xEntry->xString.reset(new OUString( rPersistEntry.pHeaderFooterEntry->pPlaceholder[ nVal ] ));
+ xEntry->xString.reset(new OUString(rPersistEntry.xHeaderFooterEntry->pPlaceholder[nVal]));
}
}
break;
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index 0af79491692e..acf4a707d111 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -359,7 +359,7 @@ struct PptSlidePersistEntry
PPTStyleSheet* pStyleSheet; // stylesheet of this page (only in masterpages), since XP supports more than one masterpage
sal_uInt32 HeaderFooterOfs[ 4 ]; // containing the ofs to the placeholder (only masterpage)
- HeaderFooterEntry* pHeaderFooterEntry;
+ std::unique_ptr<HeaderFooterEntry> xHeaderFooterEntry;
SvxMSDffSolverContainer* pSolverContainer;
sal_uInt32 nSlidePersistStartOffset;// is an array to the end of the SlidePersistAtom of this page, TextHeaderAtom is following
sal_uInt32 nSlidePersistEndOffset;
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 5029b1ff6af2..dae80f480de8 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1421,8 +1421,8 @@ void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlide
if ( ( !pList ) || ( pList->size() <= nAktPageNum ) )
return;
PptSlidePersistEntry& rSlidePersist = (*pList)[ nAktPageNum ];
- HeaderFooterEntry* pHFE = rSlidePersist.pHeaderFooterEntry;
- if ( pHFE )
+ HeaderFooterEntry* pHFE = rSlidePersist.xHeaderFooterEntry.get();
+ if (pHFE)
{
for ( i = 0; i < 4; i++ )
{
More information about the Libreoffice-commits
mailing list