Fix problem where hostname would end up with trailing . and be accepted as
[m6w6/libmemcached] / libmemcached / server_list.c
index 9287bc199ec2776af704e546c30164891e6955e3..64b8b0c4c83ed101c0cdac2198f8863dccb882a1 100644 (file)
@@ -37,13 +37,17 @@ memcached_server_list_append_with_weight(memcached_server_list_st ptr,
   new_host_list= (memcached_server_write_instance_st)realloc(ptr, sizeof(memcached_server_st) * count);
   if (!new_host_list)
   {
+    ptr->cached_errno= errno;
     *error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
     return NULL;
   }
 
-  /* TODO: Check return type */
+  /* @todo Check return type */
   memcached_server_create_with(NULL, &new_host_list[count-1], hostname, port, weight, MEMCACHED_CONNECTION_TCP);
 
+  // Handset allocated since 
+  new_host_list->options.is_allocated= true;
+
   /* Backwards compatibility hack */
   memcached_servers_set_count(new_host_list, count);