From: Yin Chen Date: Wed, 20 Aug 2008 09:05:16 +0000 (+0800) Subject: fix a bug in update_continuum X-Git-Tag: _23~3^2~3 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=8a0a471e3b703274de52e9d61c8d0c4ee714e068;p=m6w6%2Flibmemcached fix a bug in update_continuum It will casue the valgrind to report "Conditional jump or move depends on uninitialised value(s)" --- diff --git a/libmemcached/memcached_hosts.c b/libmemcached/memcached_hosts.c index 54440d35..eb8f45e5 100644 --- a/libmemcached/memcached_hosts.c +++ b/libmemcached/memcached_hosts.c @@ -174,9 +174,9 @@ memcached_return update_continuum(memcached_st *ptr) WATCHPOINT_ASSERT(ptr->continuum); WATCHPOINT_ASSERT(ptr->number_of_hosts); WATCHPOINT_ASSERT(ptr->number_of_hosts * MEMCACHED_POINTS_PER_SERVER <= MEMCACHED_CONTINUUM_SIZE); - qsort(ptr->continuum, ptr->number_of_hosts * MEMCACHED_POINTS_PER_SERVER, sizeof(memcached_continuum_item_st), continuum_item_cmp); - ptr->continuum_points_counter= pointer_counter; + qsort(ptr->continuum, ptr->continuum_points_counter, sizeof(memcached_continuum_item_st), continuum_item_cmp); + if (stat_p) memcached_stat_free(NULL, stat_p);