]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] reference leak with AAAA glue but not A
authorEvan Hunt <each@isc.org>
Fri, 14 Nov 2014 17:02:28 +0000 (09:02 -0800)
committerEvan Hunt <each@isc.org>
Fri, 14 Nov 2014 17:02:28 +0000 (09:02 -0800)
4004. [bug] When delegations had AAAA glue but not A, a
reference could be leaked causing an assertion
failure on shutdown. [RT #37796]

CHANGES
bin/check/named-checkconf.c
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index abaf9bc54e3b5b41eed40ee3d25afdefe4f2b981..1ed92b40a93eb9717d6e30672fbe25a4735c8a9c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+4004.  [bug]           When delegations had AAAA glue but not A, a
+                       reference could be leaked causing an assertion
+                       failure on shutdown. [RT #37796]
+
 4003.  [placeholder]
 
 4002.  [placeholder]
index ed00c3c5dd733d8b58e4a1c91905266761d77d58..1f4be20b877e88f9ffa9c48882c899da5e3026fe 100644 (file)
@@ -503,7 +503,33 @@ main(int argc, char **argv) {
 
        isc_commandline_errprint = ISC_FALSE;
 
-       while ((c = isc_commandline_parse(argc, argv, "dhjt:pvxz")) != EOF) {
+       /*
+        * Process memory debugging argument first.
+        */
+#define CMDLINE_FLAGS "dhjm:t:pvxz"
+       while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
+               switch (c) {
+               case 'm':
+                       if (strcasecmp(isc_commandline_argument, "record") == 0)
+                               isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
+                       if (strcasecmp(isc_commandline_argument, "trace") == 0)
+                               isc_mem_debugging |= ISC_MEM_DEBUGTRACE;
+                       if (strcasecmp(isc_commandline_argument, "usage") == 0)
+                               isc_mem_debugging |= ISC_MEM_DEBUGUSAGE;
+                       if (strcasecmp(isc_commandline_argument, "size") == 0)
+                               isc_mem_debugging |= ISC_MEM_DEBUGSIZE;
+                       if (strcasecmp(isc_commandline_argument, "mctx") == 0)
+                               isc_mem_debugging |= ISC_MEM_DEBUGCTX;
+                       break;
+               default:
+                       break;
+               }
+       }
+       isc_commandline_reset = ISC_TRUE;
+
+       RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
+
+       while ((c = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != EOF) {
                switch (c) {
                case 'd':
                        debug++;
@@ -513,6 +539,9 @@ main(int argc, char **argv) {
                        nomerge = ISC_FALSE;
                        break;
 
+               case 'm':
+                       break;
+
                case 't':
                        result = isc_dir_chroot(isc_commandline_argument);
                        if (result != ISC_R_SUCCESS) {
@@ -572,8 +601,6 @@ main(int argc, char **argv) {
        InitSockets();
 #endif
 
-       RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
-
        RUNTIME_CHECK(setup_logging(mctx, stdout, &logc) == ISC_R_SUCCESS);
 
        RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
index 494caff0685d25694b5af972d36ed7a74dc85695..6400b07479440e59d11a03e5dbc08603ce8a1a40 100644 (file)
@@ -2604,6 +2604,8 @@ zone_check_glue(dns_zone_t *zone, dns_db_t *db, dns_name_t *name,
                                     DNS_DBFIND_GLUEOK, 0, NULL,
                                     foundname, &aaaa, NULL);
                if (tresult == ISC_R_SUCCESS) {
+                       if (dns_rdataset_isassociated(&a))
+                               dns_rdataset_disassociate(&a);
                        dns_rdataset_disassociate(&aaaa);
                        return (ISC_TRUE);
                }