{
if (ptr == NULL)
{
- ptr= (memcached_server_st *)malloc(sizeof(memcached_server_st));
+ ptr= (memcached_server_st *)calloc(1, sizeof(memcached_server_st));
if (!ptr)
return NULL; /* MEMCACHED_MEMORY_ALLOCATION_FAILURE */
- memset(ptr, 0, sizeof(memcached_server_st));
ptr->is_allocated= true;
}
else
}
if (ptr->is_allocated)
- {
- if (ptr->root && ptr->root->call_free)
- ptr->root->call_free(ptr->root, ptr);
- else
- free(ptr);
- }
+ ptr->root->call_free(ptr->root, ptr);
else
memset(ptr, 0, sizeof(memcached_server_st));
}
return NULL;
}
- if ((ptr->flags & MEM_VERIFY_KEY) && (memcachd_key_test((char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
+ if ((ptr->flags & MEM_VERIFY_KEY) && (memcached_key_test((const char **)&key, &key_length, 1) == MEMCACHED_BAD_KEY_PROVIDED))
{
*error= MEMCACHED_BAD_KEY_PROVIDED;
return NULL;