From: Date: Mon, 8 Sep 2008 23:38:09 +0000 (-0700) Subject: Cleanup values for future use of memcached_server_free() X-Git-Tag: 0.25~25 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=a1afa472baad69705821165df727750356d8bb15;p=m6w6%2Flibmemcached Cleanup values for future use of memcached_server_free() --- diff --git a/libmemcached/memcached_server.c b/libmemcached/memcached_server.c index 6dff6940..1ee60101 100644 --- a/libmemcached/memcached_server.c +++ b/libmemcached/memcached_server.c @@ -27,6 +27,18 @@ memcached_server_st *memcached_server_create(memcached_st *memc, memcached_serve void memcached_server_free(memcached_server_st *ptr) { + memcached_return rc; + WATCHPOINT_ASSERT(ptr->is_allocated != MEMCACHED_NOT_ALLOCATED); + + rc= memcached_io_close(ptr); + WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS); + + if (ptr->address_info) + { + freeaddrinfo(ptr->address_info); + ptr->address_info= NULL; + } + if (ptr->is_allocated == MEMCACHED_ALLOCATED) { if (ptr->root && ptr->root->call_free)