From 417097450a014e070aa943f364155582c1a97937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 10 Nov 2022 09:30:52 +0100 Subject: [PATCH] Check view->adb in dns_view_flushcache() The call to dns_view_flushcache() is done under exclusive mode, but we still need to check if view->adb is still attached before calling dns_adb_flush() because the shutdown might have been already initialized. This most likely only a theoretical problem on shutdown because there's either no way how to initiate cache flush when shutting down or very slim window where the `rndc flush` would have to hit the slim time during named shutdown. --- lib/dns/view.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/dns/view.c b/lib/dns/view.c index e2cd0c1577..8fcf23345c 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -1528,7 +1528,10 @@ dns_view_flushcache(dns_view_t *view, bool fixuponly) { dns_badcache_flush(view->failcache); } - dns_adb_flush(view->adb); + if (view->adb) { + dns_adb_flush(view->adb); + } + return (ISC_R_SUCCESS); }