From: Brian Aker Date: Thu, 7 Apr 2011 22:59:30 +0000 (-0700) Subject: Fix issue with checking on hosts when building new list. X-Git-Tag: 0.51~15^2~24 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=448b1915f70e5d7b637af23eb94193a26f759607;p=awesomized%2Flibmemcached Fix issue with checking on hosts when building new list. --- diff --git a/libmemcached/hosts.c b/libmemcached/hosts.c index eafbb1b5..7e687667 100644 --- a/libmemcached/hosts.c +++ b/libmemcached/hosts.c @@ -339,10 +339,15 @@ memcached_return_t memcached_server_push(memcached_st *ptr, const memcached_serv WATCHPOINT_ASSERT(list[x].hostname[0] != 0); instance= memcached_server_instance_fetch(ptr, memcached_server_count(ptr)); + WATCHPOINT_ASSERT(instance); /* TODO check return type */ - (void)memcached_server_create_with(ptr, instance, list[x].hostname, - list[x].port, list[x].weight, list[x].type); + instance= memcached_server_create_with(ptr, instance, list[x].hostname, + list[x].port, list[x].weight, list[x].type); + if (! instance) + { + return memcached_set_error(ptr, MEMCACHED_MEMORY_ALLOCATION_FAILURE, NULL); + } ptr->number_of_hosts++; }