From 85a49d4198e55274ed222335a0e95d67d58ccf70 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 7 Jul 2025 14:58:47 +0100 Subject: [PATCH] ext/soap/php_http.c: Fix memory leak of header value --- NEWS | 1 + ext/soap/php_http.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d0d8c25df53..c653d946b90 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,7 @@ PHP NEWS - SOAP: . Fixed bug GH-18990, bug #81029, bug #47314 (SOAP HTTP socket not closing on object destruction). (nielsdos) + . Fix memory leak when URL parsing fails in redirect. (Girgias) - Standard: . Fix misleading errors in printf(). (nielsdos) diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 3dfafda4f95..65ce38db387 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -1128,11 +1128,11 @@ try_again: if ((loc = get_http_header_value(ZSTR_VAL(http_headers), "Location: ")) != NULL) { php_url *new_url = php_url_parse(loc); + efree(loc); if (new_url != NULL) { zend_string_release_ex(http_headers, 0); zend_string_release_ex(http_body, 0); - efree(loc); if (new_url->scheme == NULL && new_url->path != NULL) { new_url->scheme = phpurl->scheme ? zend_string_copy(phpurl->scheme) : NULL; new_url->host = phpurl->host ? zend_string_copy(phpurl->host) : NULL;