]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
MemoryTracking: make curl_docalloc() call calloc() avoiding our zero fill
authorYang Tse <yangsita@gmail.com>
Tue, 16 Aug 2011 20:24:23 +0000 (22:24 +0200)
committerYang Tse <yangsita@gmail.com>
Tue, 16 Aug 2011 20:24:23 +0000 (22:24 +0200)
lib/memdebug.c

index 3e3c1bc4f14df7b6fddb482ed2f7e7c986878cfb..e0c0d28254c16a35f78f3ec8e004f786ff70219a 100644 (file)
@@ -48,6 +48,7 @@
 struct memdebug {
   size_t size;
   union {
+    curl_off_t o;
     double d;
     void * p;
   } mem[1];
@@ -166,12 +167,9 @@ void *curl_docalloc(size_t wanted_elements, size_t wanted_size,
   user_size = wanted_size * wanted_elements;
   size = sizeof(struct memdebug) + user_size;
 
-  mem = (Curl_cmalloc)(size);
-  if(mem) {
-    /* fill memory with zeroes */
-    memset(mem->mem, 0, user_size);
+  mem = (Curl_ccalloc)(1, size);
+  if(mem)
     mem->size = user_size;
-  }
 
   if(source)
     curl_memlog("MEM %s:%d calloc(%zu,%zu) = %p\n",