From 788a68900dc72e6d3cab60312fb07c20e9677a9c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 25 Jun 2019 16:57:09 +0200 Subject: [PATCH] Fix xml doc leak in soap --- ext/soap/soap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index a74aaf7d15..61f98e9325 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1485,7 +1485,7 @@ PHP_METHOD(SoapServer, handle) int soap_version, old_soap_version; sdlPtr old_sdl = NULL; soapServicePtr service; - xmlDocPtr doc_request=NULL, doc_return; + xmlDocPtr doc_request = NULL, doc_return = NULL; zval function_name, *params, *soap_obj, retval; char *fn_name, cont_len[30]; int num_params = 0, size, i, call_status = 0; @@ -1760,8 +1760,6 @@ PHP_METHOD(SoapServer, handle) } } - doc_return = NULL; - /* Process soap headers */ if (soap_headers != NULL) { soapHeader *header = soap_headers; @@ -1913,8 +1911,6 @@ PHP_METHOD(SoapServer, handle) sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1); } - xmlFreeDoc(doc_return); - if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) { sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1); } else { @@ -1936,6 +1932,10 @@ fail: SOAP_GLOBAL(typemap) = old_typemap; SOAP_GLOBAL(features) = old_features; + if (doc_return) { + xmlFreeDoc(doc_return); + } + /* Free soap headers */ zval_ptr_dtor(&retval); while (soap_headers != NULL) { -- 2.50.1