summaryrefslogtreecommitdiff
path: root/cppuhelper
diff options
context:
space:
mode:
authorIngrid Halama <iha@openoffice.org>2010-08-19 09:18:38 +0200
committerIngrid Halama <iha@openoffice.org>2010-08-19 09:18:38 +0200
commit6d6fa3655e04cdddaf8caf380e356a8382cff425 (patch)
tree0cf1c7e4e4db0eed6f933e0d5b69a03d9e2b8b03 /cppuhelper
parent3d4977632618a91092e29f24abea884ac578b76b (diff)
chart49: #i113722# duplicate chart creation - OSingleFactoryHelper::createInstanceWithArgumentsAndContext leak
Diffstat (limited to 'cppuhelper')
-rw-r--r--cppuhelper/source/factory.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx
index 96faf2272231..20adf05391b9 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -232,9 +232,17 @@ Reference< XInterface > OSingleFactoryHelper::createInstanceWithArgumentsAndCont
else
{
if ( rArguments.getLength() )
+ {
+ // dispose the here created UNO object before throwing out exception
+ // to avoid risk of memory leaks #i113722#
+ Reference<XComponent> xComp( xRet, UNO_QUERY );
+ if (xComp.is())
+ xComp->dispose();
+
throw lang::IllegalArgumentException(
OUString( RTL_CONSTASCII_USTRINGPARAM("cannot pass arguments to component => no XInitialization implemented!") ),
Reference< XInterface >(), 0 );
+ }
}
return xRet;