Blob Blame Raw
From affcd7c5dfde7af4558601518c033725b83068bc Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka@redhat.com>
Date: Fri, 22 May 2020 15:12:15 +0200
Subject: [PATCH] http: free protocol-specific struct in setup_connection
 callback

... so that it can be setup properly later on
---
 lib/http.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lib/http.c b/lib/http.c
index 46734c4..996106f 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -98,12 +98,19 @@ static int https_getsock(struct connectdata *conn,
 #define https_connecting(x,y) CURLE_COULDNT_CONNECT
 #endif
 
+static CURLcode Curl_http_setup_conn(struct connectdata *conn)
+{
+  /* free protocol-specific struct so that it can be setup properly later on */
+  Curl_safefree(conn->data->state.proto.http);
+  return CURLE_OK;
+}
+
 /*
  * HTTP handler interface.
  */
 const struct Curl_handler Curl_handler_http = {
   "HTTP",                               /* scheme */
-  ZERO_NULL,                            /* setup_connection */
+  Curl_http_setup_conn,                 /* setup_connection */
   Curl_http,                            /* do_it */
   Curl_http_done,                       /* done */
   ZERO_NULL,                            /* do_more */
@@ -127,7 +134,7 @@ const struct Curl_handler Curl_handler_http = {
  */
 const struct Curl_handler Curl_handler_https = {
   "HTTPS",                              /* scheme */
-  ZERO_NULL,                            /* setup_connection */
+  Curl_http_setup_conn,                 /* setup_connection */
   Curl_http,                            /* do_it */
   Curl_http_done,                       /* done */
   ZERO_NULL,                            /* do_more */
-- 
1.8.3.1