From 35fbfaa4981333286437f26557db26863d4c5299 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com>
Date: Wed, 22 Jul 2020 18:55:02 +0200
Subject: [PATCH] Prevent crash on dst initialization failure

server might be created, but not yet fully initialized, when fatal
function is called. Check both server and task before attaching
exclusive task.

(cherry picked from commit c5e7152cf04f75d0fe00163f076f4cc3cafce259)
Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/35fbfaa4981333286437f26557db26863d4c5299
---
 bin/named/server.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/named/server.c b/bin/named/server.c
index e752aa71a9..9739206ae7 100644
--- a/bin/named/server.c
+++ b/bin/named/server.c
@@ -9299,7 +9299,7 @@ ns_server_destroy(ns_server_t **serverp) {
 
 static void
 fatal(ns_server_t *server, const char *msg, isc_result_t result) {
-	if (server != NULL) {
+	if (server != NULL && server->task != NULL) {
 		/*
 		 * Prevent races between the OpenSSL on_exit registered
 		 * function and any other OpenSSL calls from other tasks
-- 
2.23.0

