cURL / Mailing Lists / curl-library / Single Mail


bug in curl_easy_perform

From: T. Bharath <>
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
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


        /* 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
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
But my question here is are there any other bits,variables that need to
be reset

Received on 2001-08-23