diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-04-08 10:37:28 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-04-08 10:37:28 +0200 |
commit | d4f9d54f1a1a312986e684c20114cd9f4faf5abb (patch) | |
tree | 8e4402e58dfd484811ad0bb9ba19742f2b7ce070 | |
parent | cb338d8c4ee569ddaef840e8f26ae2aa1a1292c3 (diff) | |
parent | c3ee9d1bb7c6016663e4a55ae60afbb02f88a2e2 (diff) | |
download | php-git-d4f9d54f1a1a312986e684c20114cd9f4faf5abb.tar.gz |
Merge branch 'PHP-7.4'
* PHP-7.4:
Fix memory leak introduced by fixing bug #78221
-rw-r--r-- | ext/dom/php_dom.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 89d1d3bf53..aa01d9db20 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1301,6 +1301,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) { @@ -1326,8 +1334,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); |