]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
unload zone plugin before freeing the zone
authorColin Vidal <colin@isc.org>
Sun, 28 Sep 2025 21:07:11 +0000 (23:07 +0200)
committerColin Vidal <colin@isc.org>
Wed, 1 Oct 2025 09:11:00 +0000 (11:11 +0200)
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.

lib/dns/zone.c

index 901336780a19a3ce8938bdeb941a0ea472786ae8..f918eee2089db0f8e543108edd5e892b60bdca20 100644 (file)
@@ -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);