cURL / Mailing Lists / curl-library / Single Mail


Re: curl_multi_perform and write_callback

From: Jeroen Ooms <>
Date: Mon, 17 Nov 2014 20:15:12 -0800

On Mon, Nov 17, 2014 at 3:21 PM, Daniel Stenberg <> wrote:
> Unfortunately, there is no way to alter libcurl behavior in such a way. If
> libcurl for example gets data that expands to 3x the buffer size, it will
> call the write callback three times to let the application consume all data
> accordingly.

Thank you. So there is really no avoiding realloc.

An additional question: in the getinmemory.c example [1], why does
realloc allocate 1 byte more than needed and than sets it to 0 at the
end of the callback? The help page for CURLOPT_WRITEFUNCTION says "The
data passed to this function will not be zero terminated!". What is
the benefit of adding a 0 manually?

List admin:
Received on 2014-11-18