]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3279. [bug] Hold a internal reference to the zone while performing
authorMark Andrews <marka@isc.org>
Tue, 7 Feb 2012 00:52:05 +0000 (00:52 +0000)
committerMark Andrews <marka@isc.org>
Tue, 7 Feb 2012 00:52:05 +0000 (00:52 +0000)
                        a asynchronous load.  Address potential memory leak
                        if the asynchronous is cancelled. [RT #27750]

CHANGES
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index f49cd34ca0b9b503ca4e4641c5c669d5cbee62eb..323e943f10bfb2912485edff40e8b098d9e02644 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,8 +1,12 @@
-3277.  [bug]           Make sure automatic key maintenance is started
+3279.  [bug]           Hold a internal reference to the zone while performing
+                       a asynchronous load.  Address potential memory leak
+                       if the asynchronous is cancelled. [RT #27750]
+
+3278.  [bug]           Make sure automatic key maintenance is started
                        when "auto-dnssec maintain" is turned on during
                        "rndc reconfig". [RT #26805]
 
-3276.  [bug]           win32: isc_socket_dup is not implemented. [RT #27696]
+3277.  [bug]           win32: isc_socket_dup is not implemented. [RT #27696]
 
 3276.  [bug]           win32: ns_os_openfile failed to return NULL on
                        safe_open failure. [RT #27696]
index e2b9a57cf0f1e95a4acdaa0bef98ee70c858cea3..a1e2e5e6e459dac13a436ab09ad944c26f9e710c 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: zone.c,v 1.667.2.1 2012/01/31 01:11:55 each Exp $ */
+/* $Id: zone.c,v 1.667.2.2 2012/02/07 00:52:05 marka Exp $ */
 
 /*! \file */
 
@@ -1690,7 +1690,7 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
        isc_event_free(&event);
        if (result == ISC_R_CANCELED ||
            !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADPENDING))
-               return;
+               goto cleanup;
 
        zone_load(zone, 0);
 
@@ -1702,7 +1702,9 @@ zone_asyncload(isc_task_t *task, isc_event_t *event) {
        if (asl->loaded != NULL)
                (asl->loaded)(asl->loaded_arg, zone, task);
 
+ cleanup:
        isc_mem_put(zone->mctx, asl, sizeof (*asl));
+       dns_zone_idetach(&zone);
 }
 
 isc_result_t
@@ -1720,7 +1722,7 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) {
        if (asl == NULL)
                CHECK(ISC_R_NOMEMORY);
 
-       asl->zone = zone;
+       asl->zone = NULL;
        asl->loaded = done;
        asl->loaded_arg = arg;
 
@@ -1732,6 +1734,7 @@ dns_zone_asyncload(dns_zone_t *zone, dns_zt_zoneloaded_t done, void *arg) {
                CHECK(ISC_R_NOMEMORY);
 
        LOCK_ZONE(zone);
+       zone_iattach(zone, &asl->zone);
        DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_LOADPENDING);
        isc_task_send(zone->loadtask, &e);
        UNLOCK_ZONE(zone);