From: Ondřej Surý Date: Wed, 7 Dec 2022 15:45:33 +0000 (+0100) Subject: Release unused key file IO lock objects X-Git-Tag: v9.19.8~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb1acd6736609360f79a498d44dffcceb8ca0f54;p=thirdparty%2Fbind9.git Release unused key file IO lock objects Due to off-by-one error in zonemgr_keymgmt_delete, unused key file IO lock objects were never freed and they were kept until the server shutdown. Adjust the returned value by -1 to accomodate the fact that the atomic_fetch_*() functions return the value before the operation and not current value after the operation. --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 34e0ee58f81..65219798e9d 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -18929,7 +18929,7 @@ zonemgr_keymgmt_delete(dns_zonemgr_t *zmgr, dns_zone_t *zone) { if (dns_name_equal(kfio->name, &zone->origin)) { unsigned int count; - count = atomic_fetch_sub_relaxed(&kfio->count, 1); + count = atomic_fetch_sub_relaxed(&kfio->count, 1) - 1; if (count > 0) { /* Keep the entry. */ break;