diff options
author | David Tardon <dtardon@redhat.com> | 2011-05-16 14:55:07 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2011-05-16 15:39:29 +0200 |
commit | baf8301f80c0db8dddbb31826480c3ba799c0a67 (patch) | |
tree | edf4530c78891c3d08d048bbc621e40dc52893a9 /editeng | |
parent | cea8b8375ea692bf243d5bb7debfebe9c7886c65 (diff) |
avoid possible memory leak
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/rtf/rtfgrf.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/editeng/source/rtf/rtfgrf.cxx b/editeng/source/rtf/rtfgrf.cxx index 7b8a08c16823..5e14e760627e 100644 --- a/editeng/source/rtf/rtfgrf.cxx +++ b/editeng/source/rtf/rtfgrf.cxx @@ -29,6 +29,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_editeng.hxx" +#include <boost/scoped_ptr.hpp> + #include <osl/endian.h> #include <tools/cachestr.hxx> #include <vcl/graph.hxx> @@ -274,7 +276,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) SetSrcEncoding( RTL_TEXTENCODING_MS_1252 ); const sal_Char* pFilterNm = 0; - SvCacheStream* pTmpFile = 0; + boost::scoped_ptr<SvCacheStream> pTmpFile; int nToken = 0; bool bValidBmp = true, bFirstTextToken = true; @@ -326,7 +328,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) { rPicType.eStyle = SvxRTFPictureType::MAC_QUICKDRAW; // Mac-Pict gets a empty header above - pTmpFile = new SvCacheStream; + pTmpFile.reset(new SvCacheStream); ByteString aStr; aStr.Fill( 512, '\0' ); pTmpFile->Write( aStr.GetBuffer(), aStr.Len() ); @@ -373,7 +375,7 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) } rPicType.nType = nVal; - pTmpFile = new SvCacheStream; + pTmpFile.reset(new SvCacheStream); } break; @@ -503,7 +505,6 @@ sal_Bool SvxRTFParser::ReadBmpData( Graphic& rGrf, SvxRTFPictureType& rPicType ) pTmpFile->Seek( STREAM_SEEK_TO_BEGIN ); bValidBmp = 0 == pGF->ImportGraphic( rGrf, sTmpStr, *pTmpFile, nImportFilter, NULL, 0, pAPMHeader ); } - delete pTmpFile; } if( !bValidBmp ) |