diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-03-21 19:48:08 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-03-21 19:48:08 -0700 |
commit | 4adb4b1013e6fbd057fe6158a911e7b860a78075 (patch) | |
tree | 3d91eb7e0b16dd57d7bddcfc7a0d83103593110e /tern.c | |
parent | f8d991fc1b1ab7ae0c3d8a0307b8b2419d152278 (diff) |
Don't leak a ternary tree when building the menu's initial path
Diffstat (limited to 'tern.c')
-rw-r--r-- | tern.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -224,3 +224,16 @@ tern_node * tern_get_node(tern_val value) { return value.intval & 1 ? (tern_node *)(value.intval & ~1) : NULL; } + +void tern_free(tern_node *head) +{ + if (head->left) { + tern_free(head->left); + } + if (head->right) { + tern_free(head->right); + } + if (head->el) { + tern_free(head->straight.next); + } +} |