From ad1bfac960b2ffccf4bf853b5f3b93a782167dd3 Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Tue, 19 Jul 2016 15:40:16 +0900 Subject: [PATCH] eina rbtree iterator - fix leak found while debugging other problems there was a leak of elements on the itrator stack when the stack was flushed still having some items on it, thus losing their pointers and never freeing them. @fix --- src/lib/eina/eina_rbtree.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/eina/eina_rbtree.c b/src/lib/eina/eina_rbtree.c index ab2a001..8c074a4 100644 --- a/src/lib/eina/eina_rbtree.c +++ b/src/lib/eina/eina_rbtree.c @@ -119,7 +119,16 @@ _eina_rbtree_iterator_free(Eina_Iterator_Rbtree *it) if (eina_array_count(&iterator_trash) >= 7) { _eina_rbtree_iterator_forced_free(it); - return ; + return; + } + if (eina_array_count(it->stack) > 0) + { + unsigned int i; + Eina_Array_Iterator et; + Eina_Iterator_Rbtree_List *item; + + EINA_ARRAY_ITER_NEXT(it->stack, i, item, et) + free(item); } eina_array_flush(it->stack); -- 2.7.4