diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-11-10 14:42:04 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-11-11 08:42:31 +0100 |
commit | f0b7099a10d1a7cfbbe8f67b0ecdff5846f9805b (patch) | |
tree | 28e8247294aebbf19c44d4bcf1cdb504479742f1 /lib/http_proxy.c | |
parent | 11a46d6d66c32e4be7015aca92008d979f8b90a2 (diff) | |
download | curl-f0b7099a10d1a7cfbbe8f67b0ecdff5846f9805b.tar.gz |
multi: shut down CONNECT in Curl_detach_connnection
... to prevent a lingering pointer that would lead to a double-free.
Added test 1939 to verify.
Reported-by: Stephen M. Coakley
Fixes #7982
Closes #7986
Diffstat (limited to 'lib/http_proxy.c')
-rw-r--r-- | lib/http_proxy.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/http_proxy.c b/lib/http_proxy.c index fc050a07d..cfe616fa6 100644 --- a/lib/http_proxy.c +++ b/lib/http_proxy.c @@ -198,11 +198,11 @@ static CURLcode connect_init(struct Curl_easy *data, bool reinit) return CURLE_OK; } -static void connect_done(struct Curl_easy *data) +void Curl_connect_done(struct Curl_easy *data) { struct connectdata *conn = data->conn; struct http_connect_state *s = conn->connect_state; - if(s->tunnel_state != TUNNEL_EXIT) { + if(s && (s->tunnel_state != TUNNEL_EXIT)) { s->tunnel_state = TUNNEL_EXIT; Curl_dyn_free(&s->rcvbuf); Curl_dyn_free(&s->req); @@ -662,7 +662,7 @@ static CURLcode CONNECT(struct Curl_easy *data, if(s->close_connection && data->req.newurl) { conn->bits.proxy_connect_closed = TRUE; infof(data, "Connect me again please"); - connect_done(data); + Curl_connect_done(data); } else { free(data->req.newurl); @@ -974,7 +974,7 @@ static CURLcode CONNECT(struct Curl_easy *data, if(conn->bits.close && data->req.newurl) { conn->bits.proxy_connect_closed = TRUE; infof(data, "Connect me again please"); - connect_done(data); + Curl_connect_done(data); } else { free(data->req.newurl); @@ -1048,7 +1048,7 @@ CURLcode Curl_proxyCONNECT(struct Curl_easy *data, result = CONNECT(data, sockindex, hostname, remote_port); if(result || Curl_connect_complete(conn)) - connect_done(data); + Curl_connect_done(data); return result; } |