mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-10 16:59:59 -04:00
catzs->view should maintain a view reference
Use dns_view_weakattach and dns_view_weakdetach to maintain a
reference to the view referenced through catzs->view.
(cherry picked from commit 307e3ed9a6)
This commit is contained in:
parent
af3763a35d
commit
d12def13f6
1 changed files with 9 additions and 1 deletions
|
|
@ -818,7 +818,12 @@ dns_catz_catzs_set_view(dns_catz_zones_t *catzs, dns_view_t *view) {
|
|||
/* Either it's a new one or it's being reconfigured. */
|
||||
REQUIRE(catzs->view == NULL || !strcmp(catzs->view->name, view->name));
|
||||
|
||||
catzs->view = view;
|
||||
if (catzs->view == NULL) {
|
||||
dns_view_weakattach(view, &catzs->view);
|
||||
} else if (catzs->view != view) {
|
||||
dns_view_weakdetach(&catzs->view);
|
||||
dns_view_weakattach(view, &catzs->view);
|
||||
}
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
|
@ -1034,6 +1039,9 @@ dns__catz_zones_destroy(dns_catz_zones_t *catzs) {
|
|||
isc_task_detach(&catzs->updater);
|
||||
isc_mutex_destroy(&catzs->lock);
|
||||
isc_refcount_destroy(&catzs->references);
|
||||
if (catzs->view != NULL) {
|
||||
dns_view_weakdetach(&catzs->view);
|
||||
}
|
||||
|
||||
isc_mem_putanddetach(&catzs->mctx, catzs, sizeof(*catzs));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue