hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=9f47246074ca276341d32f9163e3e1d5c8e12014

commit 9f47246074ca276341d32f9163e3e1d5c8e12014
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Mon Jun 22 14:51:18 2015 +0900

    Autocomplete: fix memory leak on autocomplete terminate.
    
    Summary: Tree structure of lexems didn't freed, when feature terminating.
    
    Reviewers: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D2727
---
 src/lib/auto_comp.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c
index ed8e884..ca2b3e2 100644
--- a/src/lib/auto_comp.c
+++ b/src/lib/auto_comp.c
@@ -101,6 +101,27 @@ init_thread_cb(void *data, Ecore_Thread *thread 
EINA_UNUSED)
 }
 
 static void
+lexem_tree_free(lexem **root)
+{
+   lexem *data = NULL;
+   Eina_List *l = NULL;
+
+   if (!(*root)) return;
+
+   EINA_LIST_FOREACH((*root)->nodes, l, data)
+    {
+       if (data->nodes)
+         lexem_tree_free(&data);
+    }
+
+   EINA_LIST_FREE((*root)->nodes, data)
+     {
+        free(data->txt);
+        free(data);
+     }
+}
+
+static void
 context_lexem_thread_cb(void *data, Ecore_Thread *thread EINA_UNUSED)
 {
    ctx_lexem_td *td = (ctx_lexem_td *)data;
@@ -766,6 +787,8 @@ autocomp_term(void)
    evas_object_del(ad->anchor);
    ecore_thread_cancel(ad->init_thread);
 
+   lexem_tree_free((lexem **)&ad->lexem_root);
+
    eet_data_descriptor_free(lex_desc);
    eet_close(ad->source_file);
 

-- 


Reply via email to