diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index e51562ff10..981a11d377 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -80,6 +80,7 @@ struct dns_view { dns_resolver_t * resolver; dns_db_t * cachedb; dns_db_t * hints; + dns_rbt_t * secroots; isc_mutex_t lock; isc_boolean_t frozen; /* Locked by lock. */ diff --git a/lib/dns/view.c b/lib/dns/view.c index 22fcdedd72..72aff786fc 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -74,6 +75,15 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, char *name, result = ISC_R_UNEXPECTED; goto cleanup_mutex; } + view->secroots = NULL; + result = dns_rbt_create(mctx, NULL, NULL, &view->secroots); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "dns_rbt_create() failed: %s", + isc_result_totext(result)); + result = ISC_R_UNEXPECTED; + goto cleanup_dbtable; + } view->cachedb = NULL; view->hints = NULL; @@ -88,6 +98,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, char *name, return (ISC_R_SUCCESS); + cleanup_dbtable: + dns_dbtable_detach(&view->dbtable); + cleanup_mutex: isc_mutex_destroy(&view->lock); @@ -131,6 +144,7 @@ destroy(dns_view_t *view) { dns_db_detach(&view->hints); if (view->cachedb != NULL) dns_db_detach(&view->cachedb); + dns_rbt_destroy(&view->secroots); dns_dbtable_detach(&view->dbtable); isc_mutex_destroy(&view->lock); isc_mem_free(view->mctx, view->name);