From 78375aa52f1f2ae79e2d014f24e15b48ef72bea7 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 27 Jun 2019 10:57:49 +0200 Subject: 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. --- ext/soap/php_encoding.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ext/soap/php_encoding.c') diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index e88012af52..7e8a5da935 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -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); } -- cgit v1.2.1