Change free condition for tree.

This commit is contained in:
Danila Fedorin 2018-06-13 23:28:42 -07:00
parent 59f306f59e
commit 5492aa6f63

View File

@ -48,7 +48,8 @@ int _tree_foreach_free(void* data, va_list args) {
}
int _tree_needs_free(libab_tree* tree) {
return ((tree->variant == TREE_FUN && --tree->int_value) | (tree->variant != TREE_FUN));
return ((tree->variant == TREE_FUN && --(tree->int_value) == 0) |
(tree->variant != TREE_FUN));
}
void libab_tree_free_recursive(libab_tree* tree) {