cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: help -- libcurl: should i free the data when the WRITE_FUNCTION is called ?

From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Thu, 18 Mar 2010 04:11:48 -0500

On Thu, Mar 18, 2010 at 3:55 AM, Basil Su wrote:

> size_t writeFun(void *ptr, size_t size, size_t nmemb, void *stream)

> ptr is the pointer to the data, so i could get the download data in my
> program. and then i could write the data to a local file. now the problem
> is: should i free(ptr) when i've done using it to avoid memory leek?

No, that pointer is managed by libcurl. You should not free it or modify it.

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