X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached.c;h=861bafda95dbaf76dba54503cf90efc558268b6f;hb=666a820df3605bf92a4ffefed6ec3b1649f37291;hp=1ed39a915feb628e759369dba68be4f5acb4079e;hpb=122f18f5a7bf1c0361ee6edca276a0cabc95ed6d;p=m6w6%2Flibmemcached diff --git a/lib/memcached.c b/lib/memcached.c index 1ed39a91..861bafda 100644 --- a/lib/memcached.c +++ b/lib/memcached.c @@ -23,20 +23,16 @@ memcached_st *memcached_create(memcached_st *ptr) string_ptr= memcached_string_create(ptr, &ptr->result_buffer, 0); WATCHPOINT_ASSERT(string_ptr); ptr->poll_timeout= -1; - ptr->distribution= MEMCACHED_DISTRIBUTION_MODULUS; + ptr->distribution= MEMCACHED_DISTRIBUTION_MODULO; return ptr; } void memcached_free(memcached_st *ptr) { - if (ptr->hosts) - { - memcached_quit(ptr); - memcached_server_list_free(ptr->hosts); - ptr->hosts= NULL; - } - + /* If we have anything open, lets close it now */ + memcached_quit(ptr); + memcached_server_list_free(ptr->hosts); memcached_string_free(&ptr->result_buffer); if (ptr->is_allocated == MEMCACHED_ALLOCATED) @@ -57,6 +53,12 @@ memcached_st *memcached_clone(memcached_st *clone, memcached_st *ptr) if (ptr == NULL) return memcached_create(clone); + + if (ptr->is_allocated == MEMCACHED_USED) + { + WATCHPOINT_ASSERT(0); + return NULL; + } new_clone= memcached_create(clone);