From: Daniel Stenberg Date: Thu, 1 Jul 2010 21:32:20 +0000 (+0200) Subject: multi: CURLINFO_LASTSOCKET doesn't work after remove_handle X-Git-Tag: curl-7_21_1~105 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9be951a41503cd212d035496a003924f00b7aa06;p=thirdparty%2Fcurl.git multi: CURLINFO_LASTSOCKET doesn't work after remove_handle When curl_multi_remove_handle() is called and an easy handle is returned to the connection cache held in the multi handle, then we cannot allow CURLINFO_LASTSOCKET to extract it since that will more or less encourage that the user uses the socket while it can get used by libcurl again. Without this fix, we'd get a segfault in Curl_getconnectinfo() trying to dereference the NULL pointer in 'data->state.connc'. Bug: http://curl.haxx.se/bug/view.cgi?id=3023840 --- diff --git a/lib/multi.c b/lib/multi.c index ea284b3f30..9273f8dcf6 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -656,6 +656,10 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle, to that since we're not part of that handle anymore */ easy->easy_handle->state.connc = NULL; + /* Since we return the connection back to the communal connection pool + we mark the last connection as inaccessible */ + easy->easy_handle->state.lastconnect = -1; + /* Modify the connectindex since this handle can't point to the connection cache anymore.