http_proxy: restore the protocol pointer on error

Reported-by: Trail of Bits

Closes #9790
This commit is contained in:
Daniel Stenberg 2022-10-06 14:13:36 +02:00
parent 9d0869d234
commit 55e1875729
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 2 additions and 13 deletions

View File

@ -212,10 +212,8 @@ void Curl_connect_done(struct Curl_easy *data)
Curl_dyn_free(&s->rcvbuf);
Curl_dyn_free(&s->req);
/* restore the protocol pointer, if not already done */
if(s->prot_save)
data->req.p.http = s->prot_save;
s->prot_save = NULL;
/* restore the protocol pointer */
data->req.p.http = s->prot_save;
data->info.httpcode = 0; /* clear it as it might've been used for the
proxy */
data->req.ignorebody = FALSE;

View File

@ -751,15 +751,6 @@ static void conn_shutdown(struct Curl_easy *data, struct connectdata *conn)
DEBUGASSERT(data);
infof(data, "Closing connection %ld", conn->connection_id);
#ifndef USE_HYPER
if(conn->connect_state && conn->connect_state->prot_save) {
/* If this was closed with a CONNECT in progress, cleanup this temporary
struct arrangement */
data->req.p.http = NULL;
Curl_safefree(conn->connect_state->prot_save);
}
#endif
/* possible left-overs from the async name resolvers */
Curl_resolver_cancel(data);