cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Properly free()'ing memory after using CURLOPT_WRITEFUNCTION

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 2 Jun 2003 09:54:27 +0200 (CEST)

On Fri, 30 May 2003, Joel Apter wrote:

> After looking at the example given in docs/examples/getinmemory.c in the
> curl directory, I was wondering what the proper syntax and usage of free()
> would be to release this memory efficiently after it has been used
> (free(chunk.memory); ?).
>
> I am not very familiar with this type of memory handling in C. Thank you
> for your help.

Correct, to free the memory allocated by the write callback used in that
example source code, you should add a line that does something like this:

        free(chunk.memory);

-- 
 Daniel Stenberg -- curl: been grokking URLs since 1998
-------------------------------------------------------
This SF.net email is sponsored by: eBay
Get office equipment for less on eBay!
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5
Received on 2003-06-02