]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Fixup - rebalancing the tree during delete would be bad.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Feb 2007 15:32:02 +0000 (15:32 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 15 Feb 2007 15:32:02 +0000 (15:32 +0000)
git-svn-id: file:///svn/unbound/trunk@108 be551aaa-1e26-0410-a405-d3ace91eadb9

services/outside_network.c
util/rbtree.h

index 9c95f6978b9c7ee7aa10feb5e1e367c42e6728e7..f6755c044da0d4332fd0c6eb3ec51e1c91170b81 100644 (file)
@@ -350,7 +350,8 @@ outside_network_delete(struct outside_network* outnet)
                return;
        /* check every element, since we can be called on malloc error */
        if(outnet->pending) {
-               traverse_postorder(outnet->pending, pending_node_del, outnet);
+               /* free pending elements, but do no unlink from tree. */
+               traverse_postorder(outnet->pending, pending_node_del, NULL);
                free(outnet->pending);
        }
        if(outnet->udp_buff)
index 8b5b7acd9af62f0374c072b47d6f62ec490c7168..dab886a8390e5d0959af85f1e5fc9948c53be3f4 100644 (file)
@@ -183,8 +183,11 @@ rbnode_t *rbtree_previous(rbnode_t *rbtree);
  * Call function for all elements in the redblack tree, such that
  * leaf elements are called before parent elements. So that all
  * elements can be safely free()d.
+ * Note that your function must not remove the nodes from the tree.
+ * Since that may trigger rebalances of the rbtree.
  * @param tree: the tree
  * @param func: function called with element and user arg.
+ *     The function must not alter the rbtree.
  * @param arg: user argument.
  */
 void traverse_postorder(rbtree_t* tree, void (*func)(rbnode_t*, void*),