cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: calling function twice causes crash

From: Sheldon Neuberger <neuberger_at_gmail.com>
Date: Mon, 10 Jul 2006 00:40:00 -0400

> 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?

I updated to libcurl 7.15.4 and ran through the debugger again. It is now
crashing at line 321 in formdata.c. That line is "buffer =
(char*)malloc(length+add);" It enters into this part of the code when I
call
                curl_formadd(&formpost,
                                        &lastptr,
                                        CURLFORM_COPYNAME, "ipaddr",
                                        CURLFORM_COPYCONTENTS, ipAddress,
                                        CURLFORM_END);

I am not sure what the function does that contains that line (buffer =
(char*)malloc(length+add);) but when I went through the debugging it went
through that function once and it worked and it came back to it soon after
and it failed at the aforementioned line.

> What kind of crash is it?

When I run it through the debugger it says "Windows has triggered a
breakpoint" when it reaches the problem line

> The memory allocated in
> WriteMemoryCallback is never freed, but that's an unrelated bug.

I fixed the memory leak

In case you want to view the changes to the code, I have put it all up at
http://pastebin.us/1262. You can see a diff of the new and previous
version at http://pastebin.us/?diff=1262
Received on 2006-07-10