From d366250c7fc07c35be04f71c311555ab7e156d5f Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Wed, 5 Jul 2017 16:13:28 +0900 Subject: vcl: Fix memory leak at importing graphic from a URL Change-Id: I9e511f69f489e35ff5805af8fadcdd0d69cdb8d6 Reviewed-on: https://gerrit.libreoffice.org/39553 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- vcl/source/filter/graphicfilter.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 6ae9459f5bd6..8f4b1474e850 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -2360,11 +2360,9 @@ ErrCode GraphicFilter::LoadGraphic( const OUString &rPath, const OUString &rFilt aURL.SetSmartURL( rPath ); } - SvStream* pStream = nullptr; + std::unique_ptr pStream; if ( INetProtocol::File != aURL.GetProtocol() ) - { - pStream = ::utl::UcbStreamHelper::CreateStream( rPath, StreamMode::READ ); - } + pStream.reset(::utl::UcbStreamHelper::CreateStream( rPath, StreamMode::READ )); ErrCode nRes = ERRCODE_NONE; if ( !pStream ) -- cgit