Merge branch '347-various-bind-9-bugs-in-cleanup-after-fail-scenarios' into 'master'
Resolve "Various BIND 9 bugs in cleanup-after-fail scenarios" Closes #347 See merge request isc-projects/bind9!1007
This commit is contained in:
@@ -149,7 +149,7 @@ dns_ntatable_create(dns_view_t *view,
|
||||
isc_task_detach(&ntatable->task);
|
||||
|
||||
cleanup_ntatable:
|
||||
isc_mem_put(ntatable->view->mctx, ntatable, sizeof(*ntatable));
|
||||
isc_mem_put(view->mctx, ntatable, sizeof(*ntatable));
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
@@ -9891,8 +9891,11 @@ dns_resolver_create(dns_view_t *view,
|
||||
res->algorithms = NULL;
|
||||
res->digests = NULL;
|
||||
res->badcache = NULL;
|
||||
dns_badcache_init(res->mctx, DNS_RESOLVER_BADCACHESIZE,
|
||||
&res->badcache);
|
||||
result = dns_badcache_init(res->mctx, DNS_RESOLVER_BADCACHESIZE,
|
||||
&res->badcache);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_res;
|
||||
}
|
||||
res->mustbesecure = NULL;
|
||||
res->spillatmin = res->spillat = 10;
|
||||
res->spillatmax = 100;
|
||||
@@ -9915,7 +9918,7 @@ dns_resolver_create(dns_view_t *view,
|
||||
ntasks * sizeof(fctxbucket_t));
|
||||
if (res->buckets == NULL) {
|
||||
result = ISC_R_NOMEMORY;
|
||||
goto cleanup_res;
|
||||
goto cleanup_badcache;
|
||||
}
|
||||
for (i = 0; i < ntasks; i++) {
|
||||
result = isc_mutex_init(&res->buckets[i].lock);
|
||||
@@ -10080,6 +10083,9 @@ dns_resolver_create(dns_view_t *view,
|
||||
isc_mem_put(view->mctx, res->buckets,
|
||||
res->nbuckets * sizeof(fctxbucket_t));
|
||||
|
||||
cleanup_badcache:
|
||||
dns_badcache_destroy(&res->badcache);
|
||||
|
||||
cleanup_res:
|
||||
isc_mem_put(view->mctx, res, sizeof(*res));
|
||||
|
||||
|
||||
@@ -252,15 +252,19 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
view->cfg_destroy = NULL;
|
||||
view->fail_ttl = 0;
|
||||
view->failcache = NULL;
|
||||
(void)dns_badcache_init(view->mctx, DNS_VIEW_FAILCACHESIZE,
|
||||
result = dns_badcache_init(view->mctx, DNS_VIEW_FAILCACHESIZE,
|
||||
&view->failcache);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_dynkeys;
|
||||
}
|
||||
view->v6bias = 0;
|
||||
view->dtenv = NULL;
|
||||
view->dttypes = 0;
|
||||
|
||||
result = isc_mutex_init(&view->new_zone_lock);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup_dynkeys;
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_failcache;
|
||||
}
|
||||
|
||||
result = dns_order_create(view->mctx, &view->order);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
@@ -268,12 +272,14 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
}
|
||||
|
||||
result = dns_peerlist_new(view->mctx, &view->peers);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_order;
|
||||
}
|
||||
|
||||
result = dns_aclenv_init(view->mctx, &view->aclenv);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto cleanup_peerlist;
|
||||
}
|
||||
|
||||
ISC_LINK_INIT(view, link);
|
||||
ISC_EVENT_INIT(&view->resevent, sizeof(view->resevent), 0, NULL,
|
||||
@@ -293,36 +299,45 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup_peerlist:
|
||||
if (view->peers != NULL)
|
||||
if (view->peers != NULL) {
|
||||
dns_peerlist_detach(&view->peers);
|
||||
}
|
||||
|
||||
cleanup_order:
|
||||
if (view->order != NULL)
|
||||
if (view->order != NULL) {
|
||||
dns_order_detach(&view->order);
|
||||
}
|
||||
|
||||
cleanup_new_zone_lock:
|
||||
DESTROYLOCK(&view->new_zone_lock);
|
||||
|
||||
cleanup_failcache:
|
||||
dns_badcache_destroy(&view->failcache);
|
||||
|
||||
cleanup_dynkeys:
|
||||
if (view->dynamickeys != NULL)
|
||||
if (view->dynamickeys != NULL) {
|
||||
dns_tsigkeyring_detach(&view->dynamickeys);
|
||||
}
|
||||
|
||||
cleanup_references:
|
||||
INSIST(isc_refcount_decrement(&view->references) > 0);
|
||||
isc_refcount_destroy(&view->references);
|
||||
|
||||
if (view->fwdtable != NULL)
|
||||
if (view->fwdtable != NULL) {
|
||||
dns_fwdtable_destroy(&view->fwdtable);
|
||||
}
|
||||
|
||||
cleanup_zt:
|
||||
if (view->zonetable != NULL)
|
||||
if (view->zonetable != NULL) {
|
||||
dns_zt_detach(&view->zonetable);
|
||||
}
|
||||
|
||||
cleanup_mutex:
|
||||
DESTROYLOCK(&view->lock);
|
||||
|
||||
if (view->nta_file != NULL)
|
||||
if (view->nta_file != NULL) {
|
||||
isc_mem_free(mctx, view->nta_file);
|
||||
}
|
||||
|
||||
cleanup_name:
|
||||
isc_mem_free(mctx, view->name);
|
||||
|
||||
Reference in New Issue
Block a user