cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: calling function twice causes crash

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 6 Jul 2006 18:48:48 -0700

On Thu, Jul 06, 2006 at 09:01:38PM -0400, Sheldon Neuberger wrote:
> It crashes when it calls getip() for the second time. It crashes in that
> function on "curl_handle = curl_easy_init();" When I went through the
> debugger again I found curl_easy_init() is crashing on the line "res =
> Curl_open(&data);" which is in easy.c

That doesn't make sense--that line doesn't itself do anything. Are you
sure the crash isn't somewhere deeper in libcurl? What kind of crash is it?

> Since it is only ~150 lines long, I posted all the code at
> http://pastebin.us/1100. The line where it crashes is highlighted.

I didn't notice anything obviously wrong, except that almost none of the
error codes are checked. I can see a failure mode whereby the HTTP transfer
fails in the second call to getip(), causing it to return a NULL pointer
which is added to the form in curl_formadd(). That would cause a crash
in curl_easy_perform(), not curl_easy_init(). The memory allocated in
WriteMemoryCallback is never freed, but that's an unrelated bug.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2006-07-07