]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
Curl_do: avoid using stale conn pointer
authorPasha Kuznetsov <b4uuzv3dgk@snkmail.com>
Sat, 18 Dec 2010 21:35:37 +0000 (22:35 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 18 Dec 2010 21:35:37 +0000 (22:35 +0100)
Since the original `conn' pointer was used after the `connectdata' it
points to has been closed/cleaned up by Curl_reconnect_request it caused
a crash. We must make sure to use the newly created connection instead!

URL: http://curl.haxx.se/mail/lib-2010-12/0202.html

lib/url.c

index 8511ffe4c924b410bc3ea4fd0cbc5c90c4f596aa..95d024d52f8de46fe92f20596d7f4bf490ce1810 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -5347,12 +5347,13 @@ CURLcode Curl_do(struct connectdata **connp, bool *done)
 
           if(result == CURLE_OK) {
             /* ... finally back to actually retry the DO phase */
+            conn = *connp; /* re-assign conn since Curl_reconnect_request
+                              creates a new connection */
             result = conn->handler->do_it(conn, done);
           }
         }
-        else {
+        else
           return result;
-        }
     }
 
     if((result == CURLE_OK) && *done)