cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_getinfo expects a pointer to char * for this info

From: Patrik Thunström <patrik.thunstrom_at_bassetglobal.com>
Date: Mon, 14 Mar 2011 17:48:14 +0100

Lars Nilsson skrev 2011-03-14 17:42:
> On Mon, Mar 14, 2011 at 12:33 PM, Felix E. Klee<felix.klee_at_inka.de> wrote:
>> Code snippet:
>>
>> char *data = malloc(100);
>>
>> ...
> By passing a pointer to char *, accomplished by using&data in the
> call instead of data.
>
> Lars Nilsson
Also make sure not to allocate any memory for your pointer before doing
the function call, as this would lead to a memory leak. The libcURL call
itself allocates the memory needed to store the data you've requested
before giving you the pointer to that memory back.

Best regards
Patrik Thunström / patrik.thunstrom_at_bassetglobal.com

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-14