From fb9cdee4af778c5e53fc9e25f15364f5bbd2dae3 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 28 Oct 2016 11:14:38 +1100 Subject: [PATCH] 4495. [bug] A isc_mutex_init call was it being checked. [RT #43391] (cherry picked from commit f21645e1371e64b5f739afac9b1a243cafda1c0a) --- CHANGES | 2 ++ lib/dns/view.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index e4e1d7f833..31c734df1c 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +4495. [bug] A isc_mutex_init call was it being checked. [RT #43391] + 4494. [bug] Look for . [RT #43429] 4493. [bug] bin/tests/system/dyndb/driver/Makefile.in should use diff --git a/lib/dns/view.c b/lib/dns/view.c index fefb7eabfe..288ef6ce60 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -239,18 +239,22 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, view->new_zone_dbenv = NULL; view->new_zone_config = NULL; view->cfg_destroy = NULL; - isc_mutex_init(&view->new_zone_lock); view->fail_ttl = 0; view->failcache = NULL; + (void)dns_badcache_init(view->mctx, DNS_VIEW_FAILCACHESIZE, + &view->failcache); view->v6bias = 0; - dns_badcache_init(view->mctx, DNS_VIEW_FAILCACHESIZE, &view->failcache); view->dtenv = NULL; view->dttypes = 0; + result = isc_mutex_init(&view->new_zone_lock); + if (result != ISC_R_SUCCESS) + goto cleanup_dynkeys; + if (isc_bind9) { result = dns_order_create(view->mctx, &view->order); if (result != ISC_R_SUCCESS) - goto cleanup_dynkeys; + goto cleanup_new_zone_lock; } result = dns_peerlist_new(view->mctx, &view->peers); @@ -286,6 +290,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, if (view->order != NULL) dns_order_detach(&view->order); + cleanup_new_zone_lock: + DESTROYLOCK(&view->new_zone_lock); + cleanup_dynkeys: if (view->dynamickeys != NULL) dns_tsigkeyring_detach(&view->dynamickeys); @@ -515,7 +522,8 @@ destroy(dns_view_t *view) { #endif /* HAVE_LMDB */ dns_fwdtable_destroy(&view->fwdtable); dns_aclenv_destroy(&view->aclenv); - dns_badcache_destroy(&view->failcache); + if (view->failcache != NULL) + dns_badcache_destroy(&view->failcache); DESTROYLOCK(&view->new_zone_lock); DESTROYLOCK(&view->lock); isc_refcount_destroy(&view->references);