diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-02-16 14:49:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-16 15:34:47 +0000 |
commit | d929a1715da3088229f6b41b03e9713fe110b881 (patch) | |
tree | 936e17c08be2b3442c0f0aa36b74bab90dff5e0f /scaddins | |
parent | bdee6631e8b2d7e30f4dd5d2a6c529fe91888357 (diff) |
Related: fdo#74880 small leak in scaddins
Change-Id: I331a3a358c5275b770aa1319f43af21b9bb3fd83
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/analysis.cxx | 29 | ||||
-rw-r--r-- | scaddins/source/datefunc/datefunc.cxx | 23 | ||||
-rw-r--r-- | scaddins/source/pricing/pricing.cxx | 25 |
3 files changed, 23 insertions, 54 deletions
diff --git a/scaddins/source/analysis/analysis.cxx b/scaddins/source/analysis/analysis.cxx index f7b7fe8f62e0..de02b1c7adbf 100644 --- a/scaddins/source/analysis/analysis.cxx +++ b/scaddins/source/analysis/analysis.cxx @@ -120,14 +120,10 @@ OUString AnalysisAddIn::GetFuncDescrStr( sal_uInt16 nResId, sal_uInt16 nStrIndex void AnalysisAddIn::InitData( void ) { - if( pResMgr ) - delete pResMgr; - - OString aModName( "analysis" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); + delete pResMgr; + pResMgr = ResMgr::CreateResMgr("analysis", LanguageTag(aFuncLoc)); - if( pFD ) - delete pFD; + delete pFD; if( pResMgr ) pFD = new FuncDataList( *pResMgr ); @@ -153,17 +149,11 @@ AnalysisAddIn::AnalysisAddIn( const uno::Reference< uno::XComponentContext >& xC AnalysisAddIn::~AnalysisAddIn() { - if( pFD ) - delete pFD; - - if( pFactDoubles ) - delete[] pFactDoubles; - - if( pCDL ) - delete pCDL; - - if( pDefLocales ) - delete[] pDefLocales; + delete pResMgr; + delete pCDL; + delete[] pFactDoubles; + delete pFD; + delete[] pDefLocales; } sal_Int32 AnalysisAddIn::getDateMode( @@ -235,8 +225,7 @@ uno::Sequence< OUString > AnalysisAddIn::getSupportedServiceNames_Static() uno::Reference< uno::XInterface > SAL_CALL AnalysisAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& xServiceFact ) { - static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new AnalysisAddIn( comphelper::getComponentContext(xServiceFact) ); - return xInst; + return (cppu::OWeakObject*) new AnalysisAddIn( comphelper::getComponentContext(xServiceFact) ); } // XServiceName diff --git a/scaddins/source/datefunc/datefunc.cxx b/scaddins/source/datefunc/datefunc.cxx index 28d9a8dbb7e7..0aa2d7d40ee6 100644 --- a/scaddins/source/datefunc/datefunc.cxx +++ b/scaddins/source/datefunc/datefunc.cxx @@ -166,8 +166,7 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr uno::Reference< uno::XInterface > SAL_CALL ScaDateAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) { - static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new ScaDateAddIn(); - return xInst; + return (cppu::OWeakObject*) new ScaDateAddIn(); } extern "C" { @@ -208,12 +207,9 @@ ScaDateAddIn::ScaDateAddIn() : ScaDateAddIn::~ScaDateAddIn() { - if( pFuncDataList ) - delete pFuncDataList; - if( pDefLocales ) - delete[] pDefLocales; - - // pResMgr already deleted (_all_ resource managers are deleted _before_ this dtor is called) + delete pFuncDataList; + delete pResMgr; + delete[] pDefLocales; } static const sal_Char* pLang[] = { "de", "en" }; @@ -252,14 +248,9 @@ ResMgr& ScaDateAddIn::GetResMgr() throw( uno::RuntimeException ) void ScaDateAddIn::InitData() { - if( pResMgr ) - delete pResMgr; - - OString aModName( "date" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); - - if( pFuncDataList ) - delete pFuncDataList; + delete pResMgr; + pResMgr = ResMgr::CreateResMgr("date", LanguageTag(aFuncLoc)); + delete pFuncDataList; pFuncDataList = pResMgr ? new ScaFuncDataList( *pResMgr ) : NULL; diff --git a/scaddins/source/pricing/pricing.cxx b/scaddins/source/pricing/pricing.cxx index 305264eb4c5c..03e7f3965c7a 100644 --- a/scaddins/source/pricing/pricing.cxx +++ b/scaddins/source/pricing/pricing.cxx @@ -171,11 +171,9 @@ ScaFuncRes::ScaFuncRes( ResId& rResId, ResMgr& rResMgr, sal_uInt16 nIndex, OUStr uno::Reference< uno::XInterface > SAL_CALL ScaPricingAddIn_CreateInstance( const uno::Reference< lang::XMultiServiceFactory >& ) { - static uno::Reference< uno::XInterface > xInst = (cppu::OWeakObject*) new ScaPricingAddIn(); - return xInst; + return (cppu::OWeakObject*) new ScaPricingAddIn(); } - extern "C" { SAL_DLLPUBLIC_EXPORT void * SAL_CALL pricing_component_getFactory( @@ -214,12 +212,9 @@ ScaPricingAddIn::ScaPricingAddIn() : ScaPricingAddIn::~ScaPricingAddIn() { - if( pFuncDataList ) - delete pFuncDataList; - if( pDefLocales ) - delete[] pDefLocales; - - // pResMgr already deleted (_all_ resource managers are deleted _before_ this dtor is called) + delete pFuncDataList; + delete pResMgr; + delete[] pDefLocales; } static const sal_Char* pLang[] = { "de", "en" }; @@ -258,15 +253,9 @@ ResMgr& ScaPricingAddIn::GetResMgr() throw( uno::RuntimeException ) void ScaPricingAddIn::InitData() { - - if( pResMgr ) - delete pResMgr; - - OString aModName( "pricing" ); - pResMgr = ResMgr::CreateResMgr( aModName.getStr(), LanguageTag( aFuncLoc) ); - - if( pFuncDataList ) - delete pFuncDataList; + delete pResMgr; + pResMgr = ResMgr::CreateResMgr("pricing", LanguageTag( aFuncLoc) ); + delete pFuncDataList; pFuncDataList = pResMgr ? new ScaFuncDataList( *pResMgr ) : NULL; |