diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-12-23 19:16:13 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-12-24 12:52:48 +0100 |
commit | 7efbe1a977247d91896acb389c2bbd563caf6fa3 (patch) | |
tree | fcb9001c210b4e6946969f2a7b33df7576f2ca2e | |
parent | 5dae4238ea6e21df42f4437a43d152954fc494fd (diff) |
ofz#28907 Direct-leak in MetaAction::ReadMetaAction
Change-Id: I42b278c98da36bea6d628656bbb3a382327c02d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108244
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/vcl/metaact.hxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/include/vcl/metaact.hxx b/include/vcl/metaact.hxx index 600afe9b6790..ef36989df80f 100644 --- a/include/vcl/metaact.hxx +++ b/include/vcl/metaact.hxx @@ -94,7 +94,7 @@ public: virtual bool IsTransparent() const { return false; } public: - static MetaAction* ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData ); + static rtl::Reference<MetaAction> ReadMetaAction(SvStream& rIStm, ImplMetaReadData* pData); }; class UNLESS_MERGELIBS(VCL_DLLPUBLIC) MetaPixelAction final : public MetaAction diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 43cfa3070c1e..7f09b25e2025 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2688,12 +2688,12 @@ SvStream& ReadGDIMetaFile(SvStream& rIStm, GDIMetaFile& rGDIMetaFile, ImplMetaRe for( sal_uInt32 nAction = 0; ( nAction < nCount ) && !rIStm.eof(); nAction++ ) { - MetaAction* pAction = MetaAction::ReadMetaAction(rIStm, pData); + rtl::Reference<MetaAction> pAction = MetaAction::ReadMetaAction(rIStm, pData); if( pAction ) { if (pAction->GetType() == MetaActionType::COMMENT) { - MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction); + MetaCommentAction* pCommentAct = static_cast<MetaCommentAction*>(pAction.get()); if ( pCommentAct->GetComment() == "EMF_PLUS" ) rGDIMetaFile.UseCanvas( true ); } diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index c966a68309e9..be8070554fc4 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -192,9 +192,9 @@ void MetaAction::Read( SvStream&, ImplMetaReadData* ) // DO NOT read mnType - ReadMetaAction already did that! } -MetaAction* MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData ) +rtl::Reference<MetaAction> MetaAction::ReadMetaAction( SvStream& rIStm, ImplMetaReadData* pData ) { - MetaAction* pAction = nullptr; + rtl::Reference<MetaAction> pAction; sal_uInt16 nTmp = 0; rIStm.ReadUInt16( nTmp ); MetaActionType nType = static_cast<MetaActionType>(nTmp); |