aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 212e184f7..1fc11f1c7 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2058,6 +2058,9 @@ static void conn_free(struct connectdata *conn)
if(CURL_SOCKET_BAD != conn->sock[FIRSTSOCKET])
sclose(conn->sock[FIRSTSOCKET]);
+ if (conn->data->reqdata.current_conn == conn) {
+ conn->data->reqdata.current_conn = NULL;
+ }
Curl_safefree(conn->user);
Curl_safefree(conn->passwd);
Curl_safefree(conn->proxyuser);
@@ -4514,3 +4517,16 @@ CURLcode Curl_do_more(struct connectdata *conn)
return result;
}
+
+/* Called on connect, and if there's already a protocol-specific struct
+ allocated for a different connection, this frees it that it can be setup
+ properly later on. */
+void Curl_reset_reqproto(struct connectdata *conn)
+{
+ struct SessionHandle *data = conn->data;
+ if (data->reqdata.proto.generic && data->reqdata.current_conn != conn) {
+ free(data->reqdata.proto.generic);
+ data->reqdata.proto.generic = NULL;
+ }
+ data->reqdata.current_conn = conn;
+}