cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: calling function twice causes crash

From: Sheldon Neuberger <neuberger_at_gmail.com>
Date: Thu, 06 Jul 2006 18:11:09 -0400

I changed the program so that it calls curl_global_init once at the
beginning. However, when I call the getip() function the second time it
crashes when it reaches curl_easy_perform(curl_handle);

Also, I use curl twice in this program. I use it once to query a webpage
and store the data it returns in a variable. I use it again to take that
variable along with some other user-provided info and post it to a form.

On Thu, 06 Jul 2006 17:10:03 -0400, Dan Fandrich <dan_at_coneharvesters.com>
wrote:

> On Thu, Jul 06, 2006 at 02:38:40PM -0500, Shaun Dawson wrote:
>> My guess is that it is because you are calling curl_global_init more
>> than
>> once.
>
> There could really be a matching call to curl_global_cleanup at the
> end which would make it work, although since you're calling your function
> more than once you should really pull out the curl_global_init call out
> of
> the function and just call it once elsewhere. libcurl 7.15.2 added
> reference calling for these initialization functions so the program
> should actually work as-is with a new libcurl (but that doesn't make
> it correct).
>
>>>> Dan
Received on 2006-07-07