Kaydet (Commit) 2a3e221c authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Caolán McNamara

Fix a memory leak

The stream should be freed eventually in any case.

Change-Id: I5432b48de5641adc7a13a852fea49adc18bf963b
Reviewed-on: https://gerrit.libreoffice.org/9016Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst a0656ed3
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <vcl/graphicfilter.hxx> #include <vcl/graphicfilter.hxx>
#include <vcl/toolbox.hxx> #include <vcl/toolbox.hxx>
#include <svtools/miscopt.hxx> #include <svtools/miscopt.hxx>
#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::com::sun::star::awt; using namespace ::com::sun::star::awt;
...@@ -159,7 +160,7 @@ void ImageButtonToolbarController::executeControlCommand( const ::com::sun::star ...@@ -159,7 +160,7 @@ void ImageButtonToolbarController::executeControlCommand( const ::com::sun::star
bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage ) bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUString& aImageURL, Image& aImage )
{ {
SvStream* pStream = utl::UcbStreamHelper::CreateStream( aImageURL, STREAM_STD_READ ); boost::scoped_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream( aImageURL, STREAM_STD_READ ));
if ( pStream && ( pStream->GetErrorCode() == 0 )) if ( pStream && ( pStream->GetErrorCode() == 0 ))
{ {
// Use graphic class to also support more graphic formats (bmp,png,...) // Use graphic class to also support more graphic formats (bmp,png,...)
...@@ -183,7 +184,6 @@ bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUStr ...@@ -183,7 +184,6 @@ bool ImageButtonToolbarController::ReadImageFromURL( bool bBigImage, const OUStr
} }
} }
delete pStream;
return false; return false;
} }
......
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