freeing a tree needs post-order, because post order traverse child first, you can't free parent, if it has children.
a real example is linux kernel rbtree include/linux/rbtree.h rbtree_postorder_for_each_entry_safe
include/linux/rbtree.h
rbtree_postorder_for_each_entry_safe