diff --git a/CHANGES b/CHANGES index 979c83f77c..06767f7544 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2898. [bug] nslookup leaked memory when -domain=value was + specified. [RT #21301] + 2897. [bug] NSEC3 chains could be left behind when transitioning to insecure. [RT #21040] diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index b2761ad8f8..c085890769 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.328 2009/11/10 17:27:40 each Exp $ */ +/* $Id: dighost.c,v 1.329 2010/05/18 01:48:13 marka Exp $ */ /*! \file * \note @@ -1161,13 +1161,22 @@ make_searchlist_entry(char *domain) { return (search); } +static void +clear_searchlist(void) { + dig_searchlist_t *search; + while ((search = ISC_LIST_HEAD(search_list)) != NULL) { + ISC_LIST_UNLINK(search_list, search, link); + isc_mem_free(mctx, search); + } +} + static void create_search_list(lwres_conf_t *confdata) { int i; dig_searchlist_t *search; debug("create_search_list()"); - ISC_LIST_INIT(search_list); + clear_searchlist(); for (i = 0; i < confdata->searchnxt; i++) { search = make_searchlist_entry(confdata->search[i]); @@ -1210,7 +1219,7 @@ setup_system(void) { else { /* No search list. Use the domain name if any */ if (lwconf->domainname != NULL) { domain = make_searchlist_entry(lwconf->domainname); - ISC_LIST_INITANDAPPEND(search_list, domain, link); + ISC_LIST_APPEND(search_list, domain, link); domain = NULL; } } @@ -1265,15 +1274,6 @@ setup_system(void) { } -static void -clear_searchlist(void) { - dig_searchlist_t *search; - while ((search = ISC_LIST_HEAD(search_list)) != NULL) { - ISC_LIST_UNLINK(search_list, search, link); - isc_mem_free(mctx, search); - } -} - /*% * Override the search list derived from resolv.conf by 'domain'. */