]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3489. [bug] --enable-developer now turns on ISC_LIST_CHECKINIT.
authorMark Andrews <marka@isc.org>
Mon, 18 Feb 2013 20:28:24 +0000 (07:28 +1100)
committerMark Andrews <marka@isc.org>
Mon, 18 Feb 2013 20:28:24 +0000 (07:28 +1100)
                        dns_dlzcreate() failed to properly initialize
                        dlzdb.link.  When cloning a rdataset do not copy
                        the link contents.  [RT #32651]

Squashed commit of the following:

commit c36c49cbdaeec8b2506dffadbffa543283702fa2
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:24:57 2013 +1100

    don't copy the link when cloning a rdataset

commit 9fef5827edcc925075832dcce900eeca9057456d
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:23:25 2013 +1100

    initialise the dlzdb link; don't return a stale pointer on error

commit a13c584732eae2dde48920a73886b54f1fe6b030
Author: Mark Andrews <marka@isc.org>
Date:   Mon Feb 18 23:21:59 2013 +1100

    turn on ISC_LIST_CHECKINIT

CHANGES
configure
configure.in
lib/dns/dlz.c
lib/dns/rbtdb.c

diff --git a/CHANGES b/CHANGES
index 640292cba7da9d76d46e7286b447fffd2d00bbd6..234cf5c035b5edfd782a50f9e7bc847c59996741 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+3489.  [bug]           --enable-developer now turns on ISC_LIST_CHECKINIT.
+                       dns_dlzcreate() failed to properly initialize
+                       dlzdb.link.  When cloning a rdataset do not copy
+                       the link contents.  [RT #32651]
+
 3488.  [bug]           Use after free error with DH generated keys. [RT #32649]
 
 3487.  [bug]           Change 3444 was not complete.  There was a additional
index 4ec0f9089b4e390b85c2c75f0288c702ecaae127..b116a2623837b54b2dd5da9d00fb8e5962b95d61 100755 (executable)
--- a/configure
+++ b/configure
@@ -11858,6 +11858,7 @@ fi
 
 case "$enable_developer" in
 yes)
+       STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
        test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
        test "${with_atf+set}" = set || with_atf=yes
        test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
index 4df2372af28c9c51e426815d47a17fc64f9159d6..c3d9c6f9b3494d7bd8acf938185befc526e57843 100644 (file)
@@ -66,6 +66,7 @@ esac
 AC_ARG_ENABLE(developer, [  --enable-developer      enable developer build settings])
 case "$enable_developer" in
 yes)
+       STD_CDEFINES="$STD_CDEFINES -DISC_LIST_CHECKINIT=1"
        test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes
        test "${with_atf+set}" = set || with_atf=yes
        test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes
index 8da954cb45a28a6fb13e1609e259fe277fd4fa23..6b572ae980a6d170245fae181c6b36a3b4f5a7ac 100644 (file)
@@ -158,6 +158,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
 {
        dns_dlzimplementation_t *impinfo;
        isc_result_t result;
+       dns_dlzdb_t *db = NULL;
 
        /*
         * initialize the dlz_implementations list, this is guaranteed
@@ -196,33 +197,34 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
        }
 
        /* Allocate memory to hold the DLZ database driver */
-       (*dbp) = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
-       if ((*dbp) == NULL) {
+       db = isc_mem_get(mctx, sizeof(dns_dlzdb_t));
+       if (db == NULL) {
                RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
                return (ISC_R_NOMEMORY);
        }
 
        /* Make sure memory region is set to all 0's */
-       memset((*dbp), 0, sizeof(dns_dlzdb_t));
-
-       (*dbp)->implementation = impinfo;
+       memset(db, 0, sizeof(dns_dlzdb_t));
 
+       ISC_LINK_INIT(db, link);
+       db->implementation = impinfo;
        if (dlzname != NULL)
-               (*dbp)->dlzname = isc_mem_strdup(mctx, dlzname);
+               db->dlzname = isc_mem_strdup(mctx, dlzname);
 
        /* Create a new database using implementation 'drivername'. */
        result = ((impinfo->methods->create)(mctx, dlzname, argc, argv,
                                             impinfo->driverarg,
-                                            &(*dbp)->dbdata));
+                                            &db->dbdata));
 
        /* mark the DLZ driver as valid */
        if (result == ISC_R_SUCCESS) {
                RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
-               (*dbp)->magic = DNS_DLZ_MAGIC;
-               isc_mem_attach(mctx, &(*dbp)->mctx);
+               db->magic = DNS_DLZ_MAGIC;
+               isc_mem_attach(mctx, &db->mctx);
                isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
                              DNS_LOGMODULE_DLZ, ISC_LOG_DEBUG(2),
                              "DLZ driver loaded successfully.");
+               *dbp = db;
                return (ISC_R_SUCCESS);
        } else {
                isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE,
@@ -232,7 +234,7 @@ dns_dlzcreate(isc_mem_t *mctx, const char *dlzname, const char *drivername,
 
        /* impinfo->methods->create failed. */
        RWUNLOCK(&dlz_implock, isc_rwlocktype_read);
-       isc_mem_put(mctx, (*dbp), sizeof(dns_dlzdb_t));
+       isc_mem_put(mctx, db, sizeof(dns_dlzdb_t));
        return (result);
 }
 
index 9127b1ca09ee2134213fe8e8e3e9220b6f94779a..fb0c13e9a9d1c45057bdd1f65eae53030201dad9 100644 (file)
@@ -8419,7 +8419,9 @@ rdataset_clone(dns_rdataset_t *source, dns_rdataset_t *target) {
        dns_dbnode_t *cloned_node = NULL;
 
        attachnode(db, node, &cloned_node);
+       INSIST(!ISC_LINK_LINKED(target, link));
        *target = *source;
+       ISC_LINK_INIT(target, link);
 
        /*
         * Reset iterator state.