[Libreoffice-commits] core.git: sax/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 28 20:08:58 UTC 2020


 sax/source/fastparser/fastparser.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c4542dd3534e5e05307938bb7627017fb8a883cb
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Dec 28 15:03:57 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Dec 28 21:08:16 2020 +0100

    ofz#28733 Direct-leak
    
    free xmlEntityPtr the way desret_xmlEntityPtr does in libxml's testapi.c
    
    Change-Id: Ia809413c3d4e7b13e799e6c1a57e8abe61bf218d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108415
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index 9d13d25ce385..6bfa1ce0e205 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -676,7 +676,13 @@ FastSaxParserImpl::~FastSaxParserImpl()
     if( mxDocumentLocator.is() )
         mxDocumentLocator->dispose();
     for ( size_t i = 0; i < m_TemporalEntities.size(); ++i )
-        if (m_TemporalEntities[i] != nullptr) xmlFree(m_TemporalEntities[i]);
+    {
+        if (!m_TemporalEntities[i])
+            continue;
+        xmlNodePtr pPtr = reinterpret_cast<xmlNodePtr>(m_TemporalEntities[i]);
+        xmlUnlinkNode(pPtr);
+        xmlFreeNode(pPtr);
+    }
 }
 
 void FastSaxParserImpl::DefineNamespace( const OString& rPrefix, const OUString& namespaceURL )


More information about the Libreoffice-commits mailing list