cedric pushed a commit to branch efl-1.15.

http://git.enlightenment.org/core/efl.git/commit/?id=6f550fec306b0585373615595c53e2b88e841571

commit 6f550fec306b0585373615595c53e2b88e841571
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Wed Sep 30 14:59:24 2015 -0700

    edje: fix a memory leak while iterating used color class.
---
 src/lib/edje/edje_util.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index c7913ec..589b644 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -780,12 +780,13 @@ _edje_color_class_active_iterator_next(Eina_Iterator *it, 
void **data)
    Edje_Refcount *er = NULL;
    Eina_Iterator *ith;
    Edje_Color_Class *cc;
+   Eina_Bool r = EINA_FALSE;
 
    if (!eina_iterator_next(et->classes, (void **)&tuple)) return EINA_FALSE;
    if (!tuple) return EINA_FALSE;
 
    ith = eina_hash_iterator_data_new(tuple->data);
-   if (!eina_iterator_next(ith, (void **)&er)) return EINA_FALSE;
+   if (!eina_iterator_next(ith, (void **)&er)) goto on_error;
 
    /*
       We actually need to ask on an object to get the correct value.
@@ -793,7 +794,7 @@ _edje_color_class_active_iterator_next(Eina_Iterator *it, 
void **data)
       This can some times not be the case, but for now we should be fine.
     */
    cc = _edje_color_class_find(er->ed, tuple->key);
-   if (!cc) return EINA_FALSE;
+   if (!cc) goto on_error;
    et->cc = *cc;
 
    /*
@@ -801,11 +802,15 @@ _edje_color_class_active_iterator_next(Eina_Iterator *it, 
void **data)
       description for this color class. Let's bet on that for now.
     */
    cc = eina_hash_find(er->ed->file->color_hash, tuple->key);
-   if (!cc) return EINA_FALSE;
+   if (!cc) goto on_error;
    et->cc.desc = cc->desc;
 
    *data = &et->cc;
-   return EINA_TRUE;
+   r = EINA_TRUE;
+
+ on_error:
+   eina_iterator_free(ith);
+   return r;
 }
 
 static void *

-- 


Reply via email to