edje: fix a memory leak while iterating used color class.

This commit is contained in:
Cedric BAIL 2015-09-30 14:59:24 -07:00
parent 1e18cf7057
commit 8e034a8c44
1 changed files with 9 additions and 4 deletions

View File

@ -781,12 +781,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.
@ -794,7 +795,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;
/*
@ -802,11 +803,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 *