mirror of
https://github.com/curl/curl.git
synced 2026-08-24 11:33:33 +03:00
Dmitriy Sergeyev provided an example source code that crashed CVS libcurl
but that worked nicely in 7.15.5. I converted it into test case 532 and fixed the problem.
This commit is contained in:
parent
e2b48366d3
commit
552b963e6d
7 changed files with 128 additions and 10 deletions
|
|
@ -655,6 +655,12 @@ void curl_easy_reset(CURL *curl)
|
|||
{
|
||||
struct SessionHandle *data = (struct SessionHandle *)curl;
|
||||
|
||||
Curl_safefree(data->reqdata.pathbuffer);
|
||||
data->reqdata.pathbuffer=NULL;
|
||||
|
||||
Curl_safefree(data->reqdata.proto.generic);
|
||||
data->reqdata.proto.generic=NULL;
|
||||
|
||||
/* zero out UserDefined data: */
|
||||
memset(&data->set, 0, sizeof(struct UserDefined));
|
||||
|
||||
|
|
|
|||
24
lib/multi.c
24
lib/multi.c
|
|
@ -351,6 +351,8 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
|||
{
|
||||
struct Curl_multi *multi=(struct Curl_multi *)multi_handle;
|
||||
struct Curl_one_easy *easy;
|
||||
struct closure *cl;
|
||||
struct closure *prev=NULL;
|
||||
|
||||
/* First, make some basic checks that the CURLM handle is a good handle */
|
||||
if(!GOOD_MULTI_HANDLE(multi))
|
||||
|
|
@ -368,7 +370,21 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
|||
if(!easy)
|
||||
return CURLM_OUT_OF_MEMORY;
|
||||
|
||||
easy->numsocks=0;
|
||||
cl = multi->closure;
|
||||
while(cl) {
|
||||
struct closure *next = cl->next;
|
||||
if(cl->easy_handle == easy_handle) {
|
||||
/* remove this handle from the closure list */
|
||||
free(cl);
|
||||
if(prev)
|
||||
prev->next = next;
|
||||
else
|
||||
multi->closure = next;
|
||||
break; /* no need to continue since this handle can only be present once
|
||||
in the list */
|
||||
}
|
||||
cl = next;
|
||||
}
|
||||
|
||||
/* set the easy handle */
|
||||
easy->easy_handle = easy_handle;
|
||||
|
|
@ -1796,8 +1812,10 @@ static bool multi_conn_using(struct Curl_multi *multi,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* add the given data pointer to the list of 'closure handles' that are
|
||||
kept around only to be able to close some connections nicely */
|
||||
/* Add the given data pointer to the list of 'closure handles' that are kept
|
||||
around only to be able to close some connections nicely - just make sure
|
||||
that this handle isn't already added, like for the cases when an easy
|
||||
handle is removed, added and removed again... */
|
||||
static void add_closure(struct Curl_multi *multi,
|
||||
struct SessionHandle *data)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue