summaryrefslogtreecommitdiff
path: root/ext/soap/php_sdl.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-27 10:57:49 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-27 14:20:10 +0200
commit78375aa52f1f2ae79e2d014f24e15b48ef72bea7 (patch)
tree220f78276f11534189aae36fdcc2d0be096655ce /ext/soap/php_sdl.c
parentcfeda978dfa093f9d5da5a6fd6fa1090915bf418 (diff)
downloadphp-git-78375aa52f1f2ae79e2d014f24e15b48ef72bea7.tar.gz
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.
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r--ext/soap/php_sdl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 510d03c551..82fbd3bb20 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -739,7 +739,9 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0);
zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
- load_wsdl_ex(this_ptr, struri,&ctx, 0);
+ load_wsdl_ex(this_ptr, struri, &ctx, 0);
+ zend_try {
+
schema_pass2(&ctx);
n = zend_hash_num_elements(&ctx.services);
@@ -1166,6 +1168,12 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri)
soap_error0(E_ERROR, "Parsing WSDL: Could not find any usable binding services in WSDL.");
}
+ } zend_catch {
+ /* Avoid persistent memory leak. */
+ zend_hash_destroy(&ctx.docs);
+ zend_bailout();
+ } zend_end_try();
+
zend_hash_destroy(&ctx.messages);
zend_hash_destroy(&ctx.bindings);
zend_hash_destroy(&ctx.portTypes);