- org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), (ptr->number_of_hosts + 1), org::libmemcached::Instance);
+ if (ptr->number_of_hosts)
+ {
+ assert(memcached_instance_list(ptr));
+ }
+
+ if (memcached_instance_list(ptr))
+ {
+ assert(ptr->number_of_hosts);
+ }
+
+ uint32_t host_list_size= ptr->number_of_hosts +1;
+ org::libmemcached::Instance* new_host_list= libmemcached_xrealloc(ptr, memcached_instance_list(ptr), host_list_size, org::libmemcached::Instance);