cURL / Mailing Lists / curl-library / Single Mail

curl-library

Memory leak using write_cb

From: jessica rearick <jmdaisy516_at_gmail.com>
Date: Wed, 13 Sep 2006 12:24:37 -0400

I am using the following curl calls to receive data back from an HTTP POST.

CCERequestData *memory;
(curl, CURLOPT_WRITEFUNCTION, write_cb)
(curl, CURLOPT_WRITEDATA, memory)

My write_cb function looks like this below(a piece of it)
Int realsize = size * nmemb;
CCERequestData *memory = data;
(3)memory->data = (char*) realloc(memory->data, memory->len + realsize + 1);

Everything works fine, but I am recieving a memory leak on line #3. I have
tried to free(memory) within the write_cb method, but then I dont get my
response back correctly. Also note, that I do free(memory) on the
CCERequestData structure. Any suggestions please!

Thank you!
Received on 2006-09-13