curl/backport-http-free-the-url-before-storing-a-new-copy.patch
sherlock2010 fd9fed8b41 backport some patches from community
(cherry picked from commit 8afd3b243da43e6602d4780fa0312fc72c31449d)
2024-01-04 19:08:04 +08:00

34 lines
1.0 KiB
Diff

From f7170a8f2ed4dc5a4cfb3ef3c002d218c4bcecad Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 9 May 2023 08:31:11 +0200
Subject: [PATCH] http: free the url before storing a new copy
To avoid a memory-leak.
Reported-by: Hiroki Kurosawa
Closes #11093
Conflict: NA
Reference: https://github.com/curl/curl/commit/f7170a8f2ed4dc5a4cfb3ef3c002d218c4bcecad
---
lib/http.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/http.c b/lib/http.c
index bffdd3468..15cf22c5e 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -1010,7 +1010,7 @@ CURLcode Curl_http_input_auth(struct Curl_easy *data, bool proxy,
if(authp->picked == CURLAUTH_NEGOTIATE) {
CURLcode result = Curl_input_negotiate(data, conn, proxy, auth);
if(!result) {
- DEBUGASSERT(!data->req.newurl);
+ free(data->req.newurl);
data->req.newurl = strdup(data->state.url);
if(!data->req.newurl)
return CURLE_OUT_OF_MEMORY;
--
2.33.0