From 448b1915f70e5d7b637af23eb94193a26f759607 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Thu, 7 Apr 2011 15:59:30 -0700 Subject: [PATCH] Fix issue with checking on hosts when building new list. --- libmemcached/hosts.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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++; } -- 2.30.2