cURL / Mailing Lists / curl-library / Single Mail

curl-library

realloc size is (mem->size + realsize + 1)... why + 1?

From: Rieker Flaik <rieker_flaik_at_arcor.de>
Date: Sat, 11 Jun 2011 13:31:37 +0200

Hi,

in http://curl.haxx.se/libcurl/c/getinmemory.html :
 why is realloc called with this + 1 ?

static size_t
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
{
  size_t realsize = size * nmemb;
  struct MemoryStruct *mem = (struct MemoryStruct *)data;
 
  mem->memory = realloc(mem->memory, mem->size + realsize + 1);

thanks a lot,
rik

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-06-11