From: Colin Vidal Date: Sun, 28 Sep 2025 21:07:11 +0000 (+0200) Subject: unload zone plugin before freeing the zone X-Git-Tag: v9.21.14~14^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b6758cf695b04294f11819c277b6295c14038e9b;p=thirdparty%2Fbind9.git unload zone plugin before freeing the zone Make sure all zone's plugin are unloaded before the zone gets freed. This makes passing zone metadata like its origin to the plugin registering function safe, as this garantee that the origin would always be valid from the plugin lifecycle. --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 901336780a1..f918eee2089 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1237,6 +1237,8 @@ zone_free(dns_zone_t *zone) { REQUIRE(zone->timer == NULL); REQUIRE(zone->zmgr == NULL); + dns_zone_unloadplugins(zone); + isc_refcount_destroy(&zone->references); isc_refcount_destroy(&zone->irefs); @@ -1385,7 +1387,6 @@ zone_free(dns_zone_t *zone) { if (zone->gluecachestats != NULL) { isc_stats_detach(&zone->gluecachestats); } - dns_zone_unloadplugins(zone); /* last stuff */ ZONEDB_DESTROYLOCK(&zone->dblock);