diff options
Diffstat (limited to 'src/zix')
-rw-r--r-- | src/zix/common.h | 2 | ||||
-rw-r--r-- | src/zix/tree.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/zix/common.h b/src/zix/common.h index 052cb7b..c0dffeb 100644 --- a/src/zix/common.h +++ b/src/zix/common.h @@ -64,7 +64,7 @@ typedef bool (*ZixEqualFunc)(const void* a, const void* b); /** Function to destroy an element. */ -typedef void (*ZixDestroyFunc)(const void* ptr); +typedef void (*ZixDestroyFunc)(void* ptr); /**@} */ diff --git a/src/zix/tree.c b/src/zix/tree.c index 1189230..d22f438 100644 --- a/src/zix/tree.c +++ b/src/zix/tree.c @@ -101,8 +101,10 @@ ZIX_API void zix_tree_free(ZixTree* t) { - zix_tree_free_rec(t, t->root); - free(t); + if (t) { + zix_tree_free_rec(t, t->root); + free(t); + } } size_t |