]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Curl_connect_done: handle being called twice
authorDaniel Stenberg <daniel@haxx.se>
Fri, 12 Nov 2021 12:34:49 +0000 (13:34 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 12 Nov 2021 13:46:01 +0000 (14:46 +0100)
Follow-up to f0b7099a10d1a7c

When torture testing 1021, it turns out the Curl_connect_done function
might be called twice and that previously then wrongly cleared the HTTP
pointer in the second invoke.

Closes #7999

lib/http_proxy.c

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