would crash if a bad function sequence was used when shutting down after
using the multi interface (i.e using easy_cleanup after multi_cleanup) so
precautions have been added to make sure it doesn't any more - test case 529
was added to verify.
This commit is contained in:
Daniel Stenberg
2006-09-28 21:26:06 +00:00
parent b9f8a4a477
commit ae13c93b7d
10 changed files with 138 additions and 35 deletions

View File

@@ -269,13 +269,23 @@ CURLcode Curl_close(struct SessionHandle *data)
the multi handle, since that function uses the magic
field! */
if(data->state.connc && (data->state.connc->type == CONNCACHE_PRIVATE)) {
/* close all connections still alive that are in the private connection
cache, as we no longer have the pointer left to the shared one. */
close_connections(data);
if(data->state.connc) {
/* free the connection cache if allocated privately */
Curl_rm_connc(data->state.connc);
if(data->state.connc->type == CONNCACHE_PRIVATE) {
/* close all connections still alive that are in the private connection
cache, as we no longer have the pointer left to the shared one. */
close_connections(data);
/* free the connection cache if allocated privately */
Curl_rm_connc(data->state.connc);
}
}
if(data->state.shared_conn) {
/* marked to be used by a pending connection so we can't kill this handle
just yet */
data->state.closed = TRUE;
return CURLE_OK;
}
if ( ! (data->share && data->share->hostcache) ) {
@@ -284,14 +294,6 @@ CURLcode Curl_close(struct SessionHandle *data)
}
}
if(data->state.shared_conn) {
/* this handle is still being used by a shared connection cache and thus
we leave it around for now */
Curl_multi_add_closure(data->state.shared_conn, data);
return CURLE_OK;
}
/* Free the pathbuffer */
Curl_safefree(data->reqdata.pathbuffer);
Curl_safefree(data->reqdata.proto.generic);