From 04bffc4ba32932d8da18b17d5c3ecd1ae535ecaa Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Apr 2026 16:38:45 +0200 Subject: [PATCH] fixup clear data->req.cookiehost in http_set_aptr_host --- lib/http.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/http.c b/lib/http.c index 3b0190ee07..0f826f0596 100644 --- a/lib/http.c +++ b/lib/http.c @@ -2046,6 +2046,9 @@ static CURLcode http_set_aptr_host(struct Curl_easy *data) data->state.first_remote_protocol = conn->scheme->protocol; } curlx_safefree(aptr->host); +#ifndef CURL_DISABLE_COOKIES + curlx_safefree(data->req.cookiehost); +#endif ptr = Curl_checkheaders(data, STRCONST("Host")); if(ptr && (!data->state.this_is_a_follow || @@ -2081,7 +2084,6 @@ static CURLcode http_set_aptr_host(struct Curl_easy *data) if(colon) *colon = 0; /* The host must not include an embedded port number */ } - curlx_free(data->req.cookiehost); data->req.cookiehost = cookiehost; } #endif