summaryrefslogtreecommitdiff
path: root/svx/source/gallery2/gallery1.cxx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2014-06-24 13:43:40 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2014-06-25 09:12:06 +0900
commite32b78ebfd9dc6f780e73d17c794c54828471895 (patch)
tree2cd7474314572f8217e82f8b757fb1c281499958 /svx/source/gallery2/gallery1.cxx
parent3a7f55924b6901e555621e662cbc4e112396dfb9 (diff)
Avoid possible memory leaks in case of exceptions
Change-Id: I1a566a870a3bde91a527ac454fc9946e99a2593e
Diffstat (limited to 'svx/source/gallery2/gallery1.cxx')
-rw-r--r--svx/source/gallery2/gallery1.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/svx/source/gallery2/gallery1.cxx b/svx/source/gallery2/gallery1.cxx
index 8d3024f8c217..20fa438bad1f 100644
--- a/svx/source/gallery2/gallery1.cxx
+++ b/svx/source/gallery2/gallery1.cxx
@@ -34,6 +34,7 @@
#include "svx/gallery1.hxx"
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
+#include <boost/scoped_ptr.hpp>
// - Namespaces -
@@ -242,7 +243,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbDirIsReadO
OUString aTestFile( "cdefghij.klm" );
aTestURL.Append( aTestFile );
- SvStream* pTestStm = ::utl::UcbStreamHelper::CreateStream( aTestURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE );
+ boost::scoped_ptr<SvStream> pTestStm(::utl::UcbStreamHelper::CreateStream( aTestURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_WRITE ));
if( pTestStm )
{
@@ -251,7 +252,7 @@ void Gallery::ImplLoadSubDirs( const INetURLObject& rBaseURL, bool& rbDirIsReadO
if( pTestStm->GetError() )
rbDirIsReadOnly = true;
- delete pTestStm;
+ pTestStm.reset();
KillFile( aTestURL );
}
else
@@ -601,7 +602,7 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
if( FileExists( aURL ) )
{
- SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ );
+ boost::scoped_ptr<SvStream> pIStm(::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::NO_DECODE ), STREAM_READ ));
if( pIStm )
{
@@ -618,8 +619,6 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
catch (const css::ucb::ContentCreationException&)
{
}
-
- delete pIStm;
}
}