memcached_connection type)
{
memset(host, 0, sizeof(memcached_server_st));
- memcpy(host->hostname, hostname, strlen(hostname));
+ strncpy(host->hostname, hostname, MEMCACHED_MAX_HOST_LENGTH - 1);
host->port= port;
host->fd= -1;
host->type= type;
unsigned int count;
memcached_server_st *new_host_list;
- if (!hostname)
- return ptr;
+ if (hostname == NULL || error == NULL)
+ return NULL;
if (!port)
port= MEMCACHED_DEFAULT_PORT;
void memcached_server_list_free(memcached_server_st *ptr)
{
+ unsigned int x;
+
if (ptr == NULL)
return;
+ for (x= 0; x < ptr->count; x++)
+ if (ptr[x].address_info)
+ freeaddrinfo(ptr[x].address_info);
+
free(ptr);
}