From 2a3e221c8807789afcbbe9ea5eae3c3fc90a473c Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Wed, 16 Apr 2014 00:22:16 +0900 Subject: [PATCH] Fix a memory leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stream should be freed eventually in any case. Change-Id: I5432b48de5641adc7a13a852fea49adc18bf963b Reviewed-on: https://gerrit.libreoffice.org/9016 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- framework/source/uielement/imagebuttontoolbarcontroller.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 733b3223d4bb..7c385f270215 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -40,6 +40,7 @@ #include #include #include +#include using namespace ::com::sun::star; using namespace ::com::sun::star::awt; @@ -159,7 +160,7 @@ void ImageButtonToolbarController::executeControlCommand( const ::com::sun::star bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage ) { - SvStream* pStream = utl::UcbStreamHelper::CreateStream( aImageURL, STREAM_STD_READ ); + boost::scoped_ptr pStream(utl::UcbStreamHelper::CreateStream( aImageURL, STREAM_STD_READ )); if ( pStream && ( pStream->GetErrorCode() == 0 )) { // Use graphic class to also support more graphic formats (bmp,png,...) @@ -183,7 +184,6 @@ bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUStr } } - delete pStream; return false; }