cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Basil Su <hityourface_at_gmail.com>
Date: Thu, 18 Mar 2010 16:55:56 +0800

i use curl_easy_setopt(_curl, CURLOPT_WRITEFUNCTION, &writeFun) to set up
the WRITE_FUNCTION, and it is called by libcurl when it gets datas. the
funtion writeFun() is like below:

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?

thanks.

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