summaryrefslogtreecommitdiffstats
path: root/cppuhelper/source/factory.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cppuhelper/source/factory.cxx')
-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 4e34b470e608..4c203c3ef07f 100644
--- a/cppuhelper/source/factory.cxx
+++ b/cppuhelper/source/factory.cxx
@@ -229,9 +229,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;