From 00d315046bd38a660ce885c64b01fb11f2ab8574 Mon Sep 17 00:00:00 2001
From: Mark Andrews <marka@isc.org>
Date: Fri, 21 Aug 2020 19:51:59 +1000
Subject: [PATCH] Defer read of zl->server and zl->reconfig until

the reference counter has gone to zero and there is
nolonger a possibility of changes in other threads.
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/00d315046bd38a660ce885c64b01fb11f2ab8574
---
 bin/named/server.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/named/server.c b/bin/named/server.c
index 79d5d4c00b..6aca0224c7 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -8725,8 +8725,8 @@ static isc_result_t
 view_loaded(void *arg) {
 	isc_result_t result;
 	ns_zoneload_t *zl = (ns_zoneload_t *) arg;
-	ns_server_t *server = zl->server;
-	bool reconfig = zl->reconfig;
+	ns_server_t *server;
+	bool reconfig;
 	unsigned int refs;
 
 
@@ -8742,6 +8742,9 @@ view_loaded(void *arg) {
 	if (refs != 0)
 		return (ISC_R_SUCCESS);
 
+	server = zl->server;
+	reconfig = zl->reconfig;
+
 	isc_refcount_destroy(&zl->refs);
 	isc_mem_put(server->mctx, zl, sizeof (*zl));
 
-- 
2.23.0

