diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-10-04 21:11:08 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-10-04 21:11:08 +0000 |
commit | 552b963e6defebd6d0d6d41f8c74798d856c313c (patch) | |
tree | fa50268f3f5146aba03a8446ad9b1e22cfe08867 /lib | |
parent | e2b48366d385ff4b7ac1ee40aed2caaca4b22713 (diff) |
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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/easy.c | 6 | ||||
-rw-r--r-- | lib/multi.c | 24 |
2 files changed, 27 insertions, 3 deletions
diff --git a/lib/easy.c b/lib/easy.c index 0d648064d..cd931b82c 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -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)); diff --git a/lib/multi.c b/lib/multi.c index 9d596401a..46fd255f3 100644 --- a/lib/multi.c +++ b/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) { |