[Libreoffice-commits] core.git: filter/source
Mark Wielaard
mark at klomp.org
Thu Jul 11 01:22:19 PDT 2013
filter/source/msfilter/msdffimp.cxx | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 81a608e930c29f6210524df939c7a1d8b1093069
Author: Mark Wielaard <mark at klomp.org>
Date: Sun Jul 7 22:20:50 2013 +0200
Fix memory leak in SvxMSDffManager::CheckForConvertToSOObj.
Use boost::scoped_ptr for temporary SvMemoryStream.
Change-Id: I6235d7868bd20963aa5fdda32b1dd3b82cf0b182
Reviewed-on: https://gerrit.libreoffice.org/4760
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index e6d8d1e..58f455c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -136,6 +136,7 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustring.hxx>
#include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
using namespace ::com::sun::star ;
using namespace ::com::sun::star::drawing;
@@ -6838,17 +6839,17 @@ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > SvxMS
{
//TODO/MBA: check if (and when) storage and stream will be destroyed!
const SfxFilter* pFilter = 0;
- SvMemoryStream* pStream = new SvMemoryStream;
+ ::boost::scoped_ptr<SvMemoryStream> xMemStream (new SvMemoryStream);
if ( pName )
{
// TODO/LATER: perhaps we need to retrieve VisArea and Metafile from the storage also
SotStorageStreamRef xStr = rSrcStg.OpenSotStream( OUString( "package_stream" ), STREAM_STD_READ );
- *xStr >> *pStream;
+ *xStr >> *xMemStream;
}
else
{
SfxFilterMatcher aMatch( sStarName );
- SotStorageRef xStorage = new SotStorage( sal_False, *pStream );
+ SotStorageRef xStorage = new SotStorage( sal_False, *xMemStream );
rSrcStg.CopyTo( xStorage );
xStorage->Commit();
xStorage.Clear();
@@ -6864,8 +6865,8 @@ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > SvxMS
aTmpName += OUString::number(nOleCount++);
aTmpName += ".bin";
SvFileStream aTmpStream(aTmpName,STREAM_READ|STREAM_WRITE|STREAM_TRUNC);
- pStream->Seek(0);
- *pStream >> aTmpStream;
+ xMemStream->Seek(0);
+ *xMemStream >> aTmpStream;
aTmpStream.Close();
#endif
if ( pName || pFilter )
@@ -6882,7 +6883,7 @@ com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > SvxMS
uno::Sequence < beans::PropertyValue > aMedium( aFilterName.isEmpty() ? 2 : 3);
aMedium[0].Name = OUString( "InputStream" );
- uno::Reference < io::XInputStream > xStream = new ::utl::OSeekableInputStreamWrapper( *pStream );
+ uno::Reference < io::XInputStream > xStream = new ::utl::OSeekableInputStreamWrapper( *xMemStream );
aMedium[0].Value <<= xStream;
aMedium[1].Name = OUString( "URL" );
aMedium[1].Value <<= OUString( "private:stream" );
More information about the Libreoffice-commits
mailing list