From 2f12809612e2e25d6f716991462170535339a784 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Fri, 14 Jun 2024 16:44:09 +0200 Subject: [PATCH] tree: Fix freeing entities via xmlFreeNode Call xmlFreeEntity to free all entity members. Fixes #731. --- tree.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tree.c b/tree.c index 75f7569a..d5de7284 100644 --- a/tree.c +++ b/tree.c @@ -3731,17 +3731,16 @@ xmlFreeNode(xmlNodePtr cur) { xmlFreeProp((xmlAttrPtr) cur); return; } + if (cur->type == XML_ENTITY_DECL) { + xmlFreeEntity((xmlEntityPtr) cur); + return; + } if ((__xmlRegisterCallbacks) && (xmlDeregisterNodeDefaultValue)) xmlDeregisterNodeDefaultValue(cur); if (cur->doc != NULL) dict = cur->doc->dict; - if (cur->type == XML_ENTITY_DECL) { - xmlEntityPtr ent = (xmlEntityPtr) cur; - DICT_FREE(ent->SystemID); - DICT_FREE(ent->ExternalID); - } if ((cur->children != NULL) && (cur->type != XML_ENTITY_REF_NODE)) xmlFreeNodeList(cur->children);