[Libreoffice-commits] core.git: include/vcl vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Dec 24 11:53:34 UTC 2020


 include/vcl/metaact.hxx    |    2 +-
 vcl/source/gdi/gdimtf.cxx  |    4 ++--
 vcl/source/gdi/metaact.cxx |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 7efbe1a977247d91896acb389c2bbd563caf6fa3
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Dec 23 19:16:13 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Dec 24 12:52:48 2020 +0100

    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 at redhat.com>

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);


More information about the Libreoffice-commits mailing list