Fix persistent XML memory leaks in SOAP

SOAP uses a horrible bailout based error handling approach -- avoid
leaking persistent XML memory by catching bailouts in a number of
places.
This commit is contained in:
Nikita Popov 2019-06-27 10:57:49 +02:00
parent cfeda978df
commit 78375aa52f
3 changed files with 46 additions and 8 deletions

View file

@ -1519,7 +1519,13 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
text = xmlNewText(BAD_CAST(str_val));
xmlAddChild(dummy, text);
ZVAL_NULL(&data);
master_to_zval(&data, attr->encode, dummy);
/* TODO: There are other places using dummy nodes -- generalize? */
zend_try {
master_to_zval(&data, attr->encode, dummy);
} zend_catch {
xmlFreeNode(dummy);
zend_bailout();
} zend_end_try();
xmlFreeNode(dummy);
set_zval_property(ret, attr->name, &data);
}