From ab5b2ef43c86fcbf0385148d18411c915e3a0399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 3 Jan 2022 21:37:54 +0100 Subject: [PATCH] Add isc_refcount_destroy() for dns_zt reference counters The zt_destroy() function was missing isc_refcount_destroy() on the two reference counters. The isc_refcount_destroy() adds proper memory ordering on destroy and also ensures that the reference counters have been zeroed before destroying the object. --- lib/dns/zt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dns/zt.c b/lib/dns/zt.c index d4ff6fa53f..2c569dde13 100644 --- a/lib/dns/zt.c +++ b/lib/dns/zt.c @@ -222,6 +222,9 @@ flush(dns_zone_t *zone, void *uap) { static void zt_destroy(dns_zt_t *zt) { + isc_refcount_destroy(&zt->references); + isc_refcount_destroy(&zt->loads_pending); + if (atomic_load_acquire(&zt->flush)) { (void)dns_zt_apply(zt, false, NULL, flush, NULL); }