cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Dangling Pointers

From: Ryan Earl <heretic_at_mail.utexas.edu>
Date: Tue, 22 May 2001 02:09:47 -0500

Reply inline.

At 08:45 AM 5/21/2001 +0200, Daniel Stenberg wrote:
>On Sun, 20 May 2001, Ryan Earl wrote:
>
>> However... I've been playing with it for quite some time and have run
>> into runtime errors all over the place dealing with curl simply not
>> copying over specified data to internal curl data structures.
>
>Well, libcurl has quite a simple policy in this aspect: it never copies the
>data. Unless it really has to.

Cool, that's a good rule of thumb. I'll just encapsilate it all into class for multi-threaded use.

>> It would be nice if the documentation was more specific about how long I
>> have to keep around memory I use for curl arguments for all
>> functions/options.
>
>That is of course a very good idea. I need patches and help with the
>documentation as much as I need help with the code...
>
>> ie mention that I -don't- have to keep my copy around, etc. For
>> instance, in curl_easy_setopt, CURLOPT_HTTPPOST doesn't mention you have
>> to keep the post field list around until after you call
>> curl_easy_perform.
>
>In the particular case of CURLOPT_HTTPPOST, you normally build the list
>passed there with curl_formparse() and that is one of the few functions in
>libcurl that actually do strdup() the input data.

I noticed another program that used scanf to copy the data, but I was just being safe.

>> I ended up moving -all- arguments off the stack just trying to get this
>> to run, but I still am running into a weird error. With my debug build,
>> the program behaves well. It does a POST with all the correct data.
>> However, with a release build, everytime I get a memory access violation
>> error in curl_easy_perform.
>
>Ugha. Those kinds of problems are certainly painful to debug.

Yea... it really sucked. So I recompiled libcurl.lib with optimization turned off. It run fine. *shrugs* Figures, I'm just used to compiles uh... working.

>A separate note (which has nothing to do with the access violation) might be
>that judging from the looks of your program, CURLOPT_HTTPPOST might not be
>want you want. You might want CURLOPT_POST.

I actually tried that at one point... but it wasn't working at the time probably due to compiler issues.

>--
> Daniel Stenberg -- curl dude -- http://curl.haxx.se/
>
>
>
>
>_______________________________________________
>Curl-library mailing list
>Curl-library_at_lists.sourceforge.net
>http://lists.sourceforge.net/lists/listinfo/curl-library

_______________________________________________
Curl-library mailing list
Curl-library_at_lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/curl-library
Received on 2001-05-22