diff --git a/CHANGES b/CHANGES index 8e6d993723..79d4b4e664 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +5073. [bug] Destroy a task first when destroying rpzs and catzs. + [GL #84] + 5072. [bug] Add unit tests for isc_buffer_copyregion() and fix its behavior for auto-reallocated buffers. [GL #644] diff --git a/lib/dns/catz.c b/lib/dns/catz.c index 848e42a2b5..ca42a55f7d 100644 --- a/lib/dns/catz.c +++ b/lib/dns/catz.c @@ -795,7 +795,7 @@ dns_catz_catzs_detach(dns_catz_zones_t **catzsp) { *catzsp = NULL; if (isc_refcount_decrement(&catzs->refs) == 1) { - isc_refcount_destroy(&catzs->refs); + isc_task_destroy(&catzs->updater); DESTROYLOCK(&catzs->lock); if (catzs->zones != NULL) { isc_ht_iter_t *iter = NULL; @@ -815,7 +815,7 @@ dns_catz_catzs_detach(dns_catz_zones_t **catzsp) { INSIST(isc_ht_count(catzs->zones) == 0); isc_ht_destroy(&catzs->zones); } - isc_task_destroy(&catzs->updater); + isc_refcount_destroy(&catzs->refs); isc_mem_putanddetach(&catzs->mctx, catzs, sizeof(*catzs)); } } diff --git a/lib/dns/rpz.c b/lib/dns/rpz.c index 38fd3bd2cd..00751923e2 100644 --- a/lib/dns/rpz.c +++ b/lib/dns/rpz.c @@ -2148,7 +2148,12 @@ dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp) { *rpzsp = NULL; if (isc_refcount_decrement(&rpzs->refs) == 1) { - isc_refcount_destroy(&rpzs->refs); + /* + * Destroy the task first, so that nothing runs + * in the background that might race with us. + */ + isc_task_destroy(&rpzs->updater); + /* * Forget the last of view's rpz machinery after * the last reference. @@ -2178,7 +2183,7 @@ dns_rpz_detach_rpzs(dns_rpz_zones_t **rpzsp) { } DESTROYLOCK(&rpzs->maint_lock); isc_rwlock_destroy(&rpzs->search_lock); - isc_task_destroy(&rpzs->updater); + isc_refcount_destroy(&rpzs->refs); isc_mem_putanddetach(&rpzs->mctx, rpzs, sizeof(*rpzs)); } }