diff options
author | Yang Tse <yangsita@gmail.com> | 2010-03-05 20:01:47 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2010-03-05 20:01:47 +0000 |
commit | 21f331ead265b1f02ae14fd03e9af53ea5b7bd55 (patch) | |
tree | 9fdbad31d74347d11a34d0121fd9b840dd5e1413 /ares/ares_destroy.c | |
parent | f9337470882125288606676534e701c71fc1014b (diff) |
Added IPv6 name servers support
Diffstat (limited to 'ares/ares_destroy.c')
-rw-r--r-- | ares/ares_destroy.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/ares/ares_destroy.c b/ares/ares_destroy.c index 2dfb69445..d9216668f 100644 --- a/ares/ares_destroy.c +++ b/ares/ares_destroy.c @@ -1,6 +1,7 @@ /* $Id$ */ /* Copyright 1998 by the Massachusetts Institute of Technology. + * Copyright (C) 2004-2010 by Daniel Stenberg * * Permission to use, copy, modify, and distribute this * software and its documentation for any purpose and without @@ -25,7 +26,8 @@ void ares_destroy_options(struct ares_options *options) { int i; - free(options->servers); + if(options->servers) + free(options->servers); for (i = 0; i < options->ndomains; i++) free(options->domains[i]); free(options->domains); @@ -67,15 +69,7 @@ void ares_destroy(ares_channel channel) } #endif - if (channel->servers) { - for (i = 0; i < channel->nservers; i++) - { - struct server_state *server = &channel->servers[i]; - ares__close_sockets(channel, server); - assert(ares__is_list_empty(&(server->queries_to_server))); - } - free(channel->servers); - } + ares__destroy_servers_state(channel); if (channel->domains) { for (i = 0; i < channel->ndomains; i++) @@ -91,3 +85,22 @@ void ares_destroy(ares_channel channel) free(channel); } + +void ares__destroy_servers_state(ares_channel channel) +{ + struct server_state *server; + int i; + + if (channel->servers) + { + for (i = 0; i < channel->nservers; i++) + { + server = &channel->servers[i]; + ares__close_sockets(channel, server); + assert(ares__is_list_empty(&server->queries_to_server)); + } + free(channel->servers); + channel->servers = NULL; + } + channel->nservers = -1; +} |