Flip call (NULL is more common). Also add in helgrind and fix calloc.
[m6w6/libmemcached] / libmemcached / memcached.c
index 52b3834b7752fcfee7bb720e02c895c09c837fa6..a93bef7d651512ac7d49c4cf92e260fb200fb866 100644 (file)
@@ -9,12 +9,11 @@ memcached_st *memcached_create(memcached_st *ptr)
 
   if (ptr == NULL)
   {
-    ptr= (memcached_st *)malloc(sizeof(memcached_st));
+    ptr= (memcached_st *)calloc(1, sizeof(memcached_st));
 
     if (!ptr)
       return NULL; /*  MEMCACHED_MEMORY_ALLOCATION_FAILURE */
 
-    memset(ptr, 0, sizeof(memcached_st));
     ptr->is_allocated= true;
   }
   else