From e5e2fb82744daa7f9db77bd6a7168af30ff74330 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 26 Nov 2002 17:32:15 +0000
Subject: [PATCH] Dan Becker fixed a minor memory leak on persistent
 connnections using FOLLOWLOCATION and CURLOPT_USERPWD.

---
 lib/http.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/http.c b/lib/http.c
index 903deb2294..92143c4a7c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -440,6 +440,10 @@ CURLcode Curl_http_connect(struct connectdata *conn)
   if(conn->bits.user_passwd && !data->state.this_is_a_follow) {
     /* Authorization: is requested, this is not a followed location, get the
        original host name */
+    if (data->state.auth_host)
+      /* Free to avoid leaking memory on multiple requests*/
+      free(data->state.auth_host);
+
     data->state.auth_host = strdup(conn->hostname);
   }
 
-- 
GitLab