Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix memory leak introduced by fixing bug #78221
This commit is contained in:
Christoph M. Becker 2020-04-08 10:36:57 +02:00
commit c3ee9d1bb7

View file

@ -1360,6 +1360,14 @@ xmlNode *dom_get_elements_by_tag_name_ns_raw(xmlNodePtr nodep, char *ns, char *l
/* }}} */
/* }}} end dom_element_get_elements_by_tag_name_ns_raw */
static inline zend_bool is_empty_node(xmlNodePtr nodep)
{
xmlChar *strContent = xmlNodeGetContent(nodep);
zend_bool ret = strContent == NULL || *strContent == '\0';
xmlFree(strContent);
return ret;
}
/* {{{ void dom_normalize (xmlNodePtr nodep) */
void dom_normalize (xmlNodePtr nodep)
{
@ -1385,8 +1393,7 @@ void dom_normalize (xmlNodePtr nodep)
break;
}
}
strContent = xmlNodeGetContent(child);
if (*strContent == '\0') {
if (is_empty_node(child)) {
nextp = child->next;
xmlUnlinkNode(child);
php_libxml_node_free_resource(child);