]> 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:25:44 +0000 (08:25 +1100)
lib/dns/cache.c

index f95e9e3fe8eb85c8d5b79a36ce56d97ac1922b31..a21dda546a8950c0d1244d084c3d4ed5d8bbf803 100644 (file)
@@ -1216,10 +1216,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);
 
@@ -1264,6 +1270,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);
 }