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)
* 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*),