cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

Re: RE: [mem curl]

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 7 Nov 2009 09:41:23 +0100 (CET)

On Sat, 7 Nov 2009, ื๓าใ wrote:

> curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &buff);
>
> throughout the function, i can not find some sentens to allocate memery for
> buff.

That's your app's problem.

> more strange, i find author call function to free buff.

Then it is likely to crash there, or at least ruin the heap.

> So what my question is that do we need to allocate memery for buff by
> ouerselves or curl has allocate by itself?

We already answered this. You provide a pointer to *something* that is then
passed to your callback. libcurl doesn't know what the pointer is and it
doesn't do *anything* with it other than passing it along.

You can allocate it, you can have it on the stack or you can have it as a
global. libcurl doesn't care and doesn't know!

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-07

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET