Code

avltree: Don't leak memory when clearing the tree.
authorSebastian Harl <sh@tokkee.org>
Wed, 9 Jul 2014 09:44:17 +0000 (11:44 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 9 Jul 2014 09:44:17 +0000 (11:44 +0200)
Remove all nodes starting at the smallest instead of at the root.

src/utils/avltree.c

index 6189d1716131cbbc3b00cd4321b43a1de3cdaede..d8151c8926cb9f443539225eda05514347d4384c 100644 (file)
@@ -153,7 +153,7 @@ tree_clear(sdb_avltree_t *tree)
 {
        node_t *n;
 
-       n = tree->root;
+       n = node_smallest(tree);
        while (n) {
                node_t *tmp = node_next(n);