Custom memory patch work (based on Sean Chittenden's patch)
[m6w6/libmemcached] / lib / memcached_result.c
index 89de40301552ff891ca908b481068edd822f6692..45bd3975e68b2503a919282087acf40fd26aa97d 100644 (file)
@@ -17,8 +17,12 @@ memcached_result_st *memcached_result_create(memcached_st *memc,
   }
   else
   {
-    ptr= (memcached_result_st *)malloc(sizeof(memcached_result_st));
-    if (!ptr)
+    if (memc->call_malloc)
+      ptr= (memcached_result_st *)memc->call_malloc(ptr->root, sizeof(memcached_result_st));
+    else
+      ptr= (memcached_result_st *)malloc(sizeof(memcached_result_st));
+
+    if (ptr == NULL)
       return NULL;
     memset(ptr, 0, sizeof(memcached_result_st));
     ptr->is_allocated= MEMCACHED_ALLOCATED;