--- sfx2/source/doc/objcont.cxx (revision 1352098) +++ sfx2/source/doc/objcont.cxx (working copy) @@ -764,8 +764,13 @@ sal_uInt16 nStyles = pIter->Count(); SfxStyleSheetBase *pStyle = pIter->First(); if ( !pStyle ) - return sal_True; + { + // memory leak #i120077# + delete pIter; + return sal_True; + } + // pepare adaptor for old style StartPage/EndPage printing boost::shared_ptr< Printer > pPrinter( new Printer( rPrt.GetJobSetup() ) ); vcl::OldStylePrintAdaptor* pAdaptor = new vcl::OldStylePrintAdaptor( pPrinter ); --- sc/source/filter/xml/xmlfonte.cxx (revision 1348808) +++ sc/source/filter/xml/xmlfonte.cxx (working copy) @@ -45,11 +45,14 @@ class ScXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool { - void AddFontItems(sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const sal_Bool bExportDefaults); - public: +private: + // #i120077# remember owned pool + SfxItemPool* mpEditEnginePool; + void AddFontItems(sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const sal_Bool bExportDefaults); +public: ScXMLFontAutoStylePool_Impl( ScXMLExport& rExport ); - + virtual ~ScXMLFontAutoStylePool_Impl(); }; void ScXMLFontAutoStylePool_Impl::AddFontItems(sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const sal_Bool bExportDefaults) @@ -83,7 +86,8 @@ ScXMLFontAutoStylePool_Impl::ScXMLFontAutoStylePool_Impl( ScXMLExport& rExportP ) : - XMLFontAutoStylePool( rExportP ) + XMLFontAutoStylePool( rExportP ), + mpEditEnginePool(0) { sal_uInt16 aWhichIds[3] = { ATTR_FONT, ATTR_CJK_FONT, ATTR_CTL_FONT }; @@ -101,9 +105,13 @@ if(pItr) { SfxStyleSheetBase* pStyle(pItr->First()); - SfxItemPool* pPageEditPool(EditEngine::CreatePool()); + + // #i120077# init pool and use it + mpEditEnginePool = EditEngine::CreatePool(); // memory leak #i120077#, to save the SfxItemPool obj into member data for releasing + SfxItemPool* pPageEditPool( mpEditEnginePool ); EditEngine aEditEngine(pPageEditPool); - while (pStyle) + + while (pStyle) { const SfxItemPool& rPagePool(pStyle->GetPool().GetPool()); for (sal_uInt8 j = 0; j < 4; ++j) @@ -138,9 +146,20 @@ } pStyle = pItr->Next(); } + + // memory leak #i120077# + delete pItr; } } +ScXMLFontAutoStylePool_Impl::~ScXMLFontAutoStylePool_Impl() +{ + if(mpEditEnginePool) + { + // memory leak #i120077# + SfxItemPool::Free(mpEditEnginePool); + } +} XMLFontAutoStylePool* ScXMLExport::CreateFontAutoStylePool() { --- sc/source/core/data/patattr.cxx (revision 1348808) +++ sc/source/core/data/patattr.cxx (working copy) @@ -1197,6 +1197,9 @@ SfxStyleSheetIterator* pIter = pDoc->GetStyleSheetPool()->CreateIterator( SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_ALL ); pStyle = (ScStyleSheet*)pIter->First(); + + // memory leak #i120077# + delete pIter; } if (pStyle) --- sc/source/core/data/stlsheet.cxx (revision 1348808) +++ sc/source/core/data/stlsheet.cxx (working copy) @@ -123,6 +123,9 @@ pStyle = pIter->First(); if (pStyle) aEffName = pStyle->GetName(); + + // memory leak #i120077# + delete pIter; } if ( pStyle && aEffName != GetName() )