cURL / Mailing Lists / curl-library / Single Mail


Memory leak in getinmemory.c example?

From: <>
Date: Sun, 6 Dec 2015 13:06:58 +0000

Hello everyone,

I think there is a memory leak in WriteMemoryCallback() :
> mem->memory = realloc(mem->memory, mem->size + realsize + 1);

Correct me if I am wrong, but according to you still have to free the old pointer if realloc fails (i.e. returns NULL), which is obviously impossible if you directly overwrite it.

Kind regards
Henrik S. GaƟmann

List admin:
Received on 2015-12-06