Kaydet (Commit) 7f0acedf authored tarafından Caolán McNamara's avatar Caolán McNamara

CID#441342 potential resource leak

Change-Id: Ia39e8c53427347088aa8d58ae1220950f191cd91
üst df60b2f7
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment