X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=libmemcached%2Fhosts.c;h=7e68766749e39fa0e1a2b5f97cd8bc37aee4d0d1;hb=448b1915f70e5d7b637af23eb94193a26f759607;hp=eafbb1b534ca083e76cb76fc75698403047549fe;hpb=c4dbc7e56b01545e25bc95ba122c79d4a2631a99;p=m6w6%2Flibmemcached 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++; }