hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=7020fec1f3dfb141e0d02f374bde5e0ad8f68dcb

commit 7020fec1f3dfb141e0d02f374bde5e0ad8f68dcb
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Mon Jun 22 14:45:54 2015 +0900

    Autocomplete: fix memory leak.
    
    Summary:
    When context_lexem_thread_cb is canceled - possible, that
    td->utf8 memory, that allocated at context_lexem_get
    didn't freed.
    
    Reviewers: Hermet
    
    Differential Revision: https://phab.enlightenment.org/D2726
---
 src/lib/auto_comp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lib/auto_comp.c b/src/lib/auto_comp.c
index 211cd4c..ed8e884 100644
--- a/src/lib/auto_comp.c
+++ b/src/lib/auto_comp.c
@@ -209,8 +209,6 @@ context_lexem_thread_cb(void *data, Ecore_Thread *thread 
EINA_UNUSED)
         cur++;
      }
 
-   free(utf8);
-
    if (quot_cnt % 2)
      {
         td->result = NULL;
@@ -250,6 +248,7 @@ context_lexem_thread_end_cb(void *data, Ecore_Thread 
*thread EINA_UNUSED)
 
    if (td->list_show && td->result)
      candidate_list_show(td->ad);
+   free(td->utf8);
    free(td);
 }
 
@@ -263,6 +262,7 @@ context_lexem_thread_cancel_cb(void *data, Ecore_Thread 
*thread EINA_UNUSED)
      candidate_list_show(td->ad);
    if (td->ad->cntx_lexem_thread == thread)
      td->ad->cntx_lexem_thread = NULL;
+   free(td->utf8);
    free(td);
 }
 
@@ -280,7 +280,7 @@ context_lexem_get(autocomp_data *ad, Evas_Object *entry, 
Eina_Bool list_show)
       ecore_thread_cancel(ad->cntx_lexem_thread);
 
    ctx_lexem_td *td = (ctx_lexem_td *)calloc(1, sizeof(ctx_lexem_td));
-   td->utf8 =  elm_entry_markup_to_utf8(text);
+   td->utf8 = elm_entry_markup_to_utf8(text);
    td->cur_pos = elm_entry_cursor_pos_get(entry);
    td->ad = ad;
    td->result = NULL;

-- 


Reply via email to