Skip to content

Commit 788a689

Browse files
committed
Fix xml doc leak in soap
1 parent 80958d0 commit 788a689

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ext/soap/soap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,7 @@ PHP_METHOD(SoapServer, handle)
14851485
int soap_version, old_soap_version;
14861486
sdlPtr old_sdl = NULL;
14871487
soapServicePtr service;
1488-
xmlDocPtr doc_request=NULL, doc_return;
1488+
xmlDocPtr doc_request = NULL, doc_return = NULL;
14891489
zval function_name, *params, *soap_obj, retval;
14901490
char *fn_name, cont_len[30];
14911491
int num_params = 0, size, i, call_status = 0;
@@ -1760,8 +1760,6 @@ PHP_METHOD(SoapServer, handle)
17601760
}
17611761
}
17621762

1763-
doc_return = NULL;
1764-
17651763
/* Process soap headers */
17661764
if (soap_headers != NULL) {
17671765
soapHeader *header = soap_headers;
@@ -1913,8 +1911,6 @@ PHP_METHOD(SoapServer, handle)
19131911
sapi_add_header("Content-Type: text/xml; charset=utf-8", sizeof("Content-Type: text/xml; charset=utf-8")-1, 1);
19141912
}
19151913

1916-
xmlFreeDoc(doc_return);
1917-
19181914
if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
19191915
sapi_add_header("Connection: close", sizeof("Connection: close")-1, 1);
19201916
} else {
@@ -1936,6 +1932,10 @@ PHP_METHOD(SoapServer, handle)
19361932
SOAP_GLOBAL(typemap) = old_typemap;
19371933
SOAP_GLOBAL(features) = old_features;
19381934

1935+
if (doc_return) {
1936+
xmlFreeDoc(doc_return);
1937+
}
1938+
19391939
/* Free soap headers */
19401940
zval_ptr_dtor(&retval);
19411941
while (soap_headers != NULL) {

0 commit comments

Comments
 (0)