summaryrefslogtreecommitdiff
path: root/sot
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-10-03 09:30:46 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-10-03 13:09:20 +0100
commit7f0acedf9b5a7544f88af426d7ed3cf0e58176dd (patch)
treedc57753a04c8e62282284fdca9d507347816eeb0 /sot
parentdf60b2f7685e5a2b732a49cb6f9954d2dfcfce16 (diff)
CID#441342 potential resource leak
Change-Id: Ia39e8c53427347088aa8d58ae1220950f191cd91
Diffstat (limited to 'sot')
-rw-r--r--sot/source/sdstor/ucbstorage.cxx9
1 files changed, 3 insertions, 6 deletions
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 0e428dab4b25..b0801e3a0060 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/packages/manifest/ManifestReader.hpp>
#include <com/sun/star/ucb/InteractiveIOException.hpp>
+#include <boost/scoped_ptr.hpp>
#include <rtl/digest.h>
#include <tools/ref.hxx>
#include <tools/debug.hxx>
@@ -2139,15 +2140,15 @@ sal_Int16 UCBStorage_Impl::Commit()
{
UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
::ucbhelper::Content* pContent = pElement->GetContent();
- bool bDeleteContent = false;
+ boost::scoped_ptr< ::ucbhelper::Content > xDeleteContent;
if ( !pContent && pElement->IsModified() )
{
// if the element has never been opened, no content has been created until now
- bDeleteContent = true; // remember to delete it later
OUString aName( m_aURL );
aName += "/";
aName += pElement->m_aOriginalName;
pContent = new ::ucbhelper::Content( aName, Reference< ::com::sun::star::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
+ xDeleteContent.reset(pContent); // delete it later on exit scope
}
if ( pElement->m_bIsRemoved )
@@ -2220,10 +2221,6 @@ sal_Int16 UCBStorage_Impl::Commit()
nRet = nLocalRet;
}
- if ( bDeleteContent )
- // content was created inside the loop
- delete pContent;
-
if ( nRet == COMMIT_RESULT_FAILURE )
break;
}