]> 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:31:26 +0000 (07:31 +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

Conflicts:
lib/dns/dlz.c

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

diff --git a/CHANGES b/CHANGES
index 654cbb3e2d7abea277dad4ff24a9f7ae21659fa9..ef1cf22f622437011738cfe0694233241b4d942a 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 f06bfef579ff87589428dadff5966eef1ebfd100..4648b751cb552d65c4e6dadccb92c1841ed3470b 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 f0a3acfe15703f15043974b5652eec9962aa004a..b522c183d186094bb1b13349f53f654c866b95c4 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 c039dd5a6615f1cea26d25ee81bcf7bf7b7c9f6b..3676cd4c95b7827244cd26d042d259cf201e1775 100644 (file)
@@ -142,6 +142,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
@@ -180,30 +181,32 @@ 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));
+       memset(db, 0, sizeof(dns_dlzdb_t));
 
-       (*dbp)->implementation = impinfo;
+       db->implementation = impinfo;
+       ISC_LINK_INIT(db, link);
 
        /* 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,
@@ -213,7 +216,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 af7cddb3bd8cdd588269a04fefed2818bd7ec739..861f4b2c54e219cb96cff27ccac38fc1f2617f71 100644 (file)
@@ -7984,7 +7984,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.