]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
attempt to create a node at the flushtree name
authorMark Andrews <marka@isc.org>
Sat, 26 Mar 2016 21:25:44 +0000 (08:25 +1100)
committerMark Andrews <marka@isc.org>
Sat, 26 Mar 2016 21:26:11 +0000 (08:26 +1100)
(cherry picked from commit dd185fb371632b9cf1b7be3097960185c9645a09)

lib/dns/cache.c

index 21d494108f6014e62e70177c1d9a09a21b4f825d..0b6ddb46f2db4c750454f1d44810c52a88f04b44 100644 (file)
@@ -1199,10 +1199,16 @@ static isc_result_t
 cleartree(dns_db_t *db, dns_name_t *name) {
        isc_result_t result, answer = ISC_R_SUCCESS;
        dns_dbiterator_t *iter = NULL;
-       dns_dbnode_t *node = NULL;
+       dns_dbnode_t *node = NULL, *top = NULL;
        dns_fixedname_t fnodename;
        dns_name_t *nodename;
 
+       /*
+        * Create the node if it doesn't exist so dns_dbiterator_seek()
+        * can find it.  We will continue even if this fails.
+        */
+       (void)dns_db_findnode(db, name, ISC_TRUE, &top);
+
        dns_fixedname_init(&fnodename);
        nodename = dns_fixedname_name(&fnodename);
 
@@ -1247,6 +1253,8 @@ cleartree(dns_db_t *db, dns_name_t *name) {
                dns_db_detachnode(db, &node);
        if (iter != NULL)
                dns_dbiterator_destroy(&iter);
+       if (top != NULL)
+               dns_db_detachnode(db, &top);
 
        return (answer);
 }