curl-library
bug in curl_easy_perform
Date: Thu, 23 Aug 2001 09:07:49 -0400
There seems to be a bug in Curl_perform when it is repeatedly called
like in here
curl_easy_setopt(...) //some common opts
while(list)
{
curl_easy_setopt(handle,CURLOPT_URL,list->url)
ret = curl_easy_perform(handle);
free(list->url); // crashes here when an earlier url causes redirection
list =list->next;
}
The problem happens in Curl_perform(struct UrlData *data)
It actually happens in the following lines
if(data->bits.urlstringalloc)
free(data->url);
/* TBD: set the URL with curl_setopt() */
data->url = newurl;
newurl = NULL; /* don't free! */
data->bits.urlstringalloc = TRUE;
Lets say in the while loop in the client code(my code)
when one url is downloaded ,it comes with a location header causing
redirection and
data->bits.urlstringalloc = TRUE is set
Lets say that download is complete
Now when another url is to be downloaded
data->bits.urlstringalloc is still set so
when it comes to
if(data->bits.urlstringalloc)
free(data->url);
it frees the url even though it shouldnt since in this
run there was no redirection
The result is in the client code when i deallocate the url
it crashes
Now the solution is to reset it at the begginning or the end of
Curl_perform
But my question here is are there any other bits,variables that need to
be reset
Regards
Bharath
Received on 2001-08-23