From a10ac1c796a4dc02ed205699bf76dae0eaccf07b Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 7 Mar 2014 12:39:23 +0300 Subject: [PATCH] avl: add a counter for when you allocate or free a stree I'll add the users in a later patch. Signed-off-by: Dan Carpenter --- avl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/avl.c b/avl.c index 5cfb8580..a7317a98 100644 --- a/avl.c +++ b/avl.c @@ -42,6 +42,8 @@ static bool checkBalances(AvlNode *node, int *height); static bool checkOrder(struct stree *avl); static size_t countNode(AvlNode *node); +int unfree_stree; + /* * Utility macros for converting between * "balance" values (-1 or 1) and "side" values (0 or 1). @@ -67,6 +69,7 @@ struct stree *avl_new(void) { struct stree *avl = malloc(sizeof(*avl)); + unfree_stree++; assert(avl != NULL); avl->root = NULL; @@ -89,6 +92,8 @@ void free_stree(struct stree **avl) return; } + unfree_stree--; + freeNode((*avl)->root); free(*avl); *avl = NULL; -- 2.11.4.GIT