summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-09-30 14:59:24 -0700
committerCedric BAIL <cedric@osg.samsung.com>2015-09-30 15:13:47 -0700
commit6f550fec306b0585373615595c53e2b88e841571 (patch)
tree0dae82ae01ac73d9cc19d029a72b2cdd3d70727b
parent9fed51cf7932f311edbaeb9a10563e865c7ddd24 (diff)
edje: fix a memory leak while iterating used color class.
-rw-r--r--src/lib/edje/edje_util.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index c7913ecbac..589b644ced 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)
780 Edje_Refcount *er = NULL; 780 Edje_Refcount *er = NULL;
781 Eina_Iterator *ith; 781 Eina_Iterator *ith;
782 Edje_Color_Class *cc; 782 Edje_Color_Class *cc;
783 Eina_Bool r = EINA_FALSE;
783 784
784 if (!eina_iterator_next(et->classes, (void **)&tuple)) return EINA_FALSE; 785 if (!eina_iterator_next(et->classes, (void **)&tuple)) return EINA_FALSE;
785 if (!tuple) return EINA_FALSE; 786 if (!tuple) return EINA_FALSE;
786 787
787 ith = eina_hash_iterator_data_new(tuple->data); 788 ith = eina_hash_iterator_data_new(tuple->data);
788 if (!eina_iterator_next(ith, (void **)&er)) return EINA_FALSE; 789 if (!eina_iterator_next(ith, (void **)&er)) goto on_error;
789 790
790 /* 791 /*
791 We actually need to ask on an object to get the correct value. 792 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)
793 This can some times not be the case, but for now we should be fine. 794 This can some times not be the case, but for now we should be fine.
794 */ 795 */
795 cc = _edje_color_class_find(er->ed, tuple->key); 796 cc = _edje_color_class_find(er->ed, tuple->key);
796 if (!cc) return EINA_FALSE; 797 if (!cc) goto on_error;
797 et->cc = *cc; 798 et->cc = *cc;
798 799
799 /* 800 /*
@@ -801,11 +802,15 @@ _edje_color_class_active_iterator_next(Eina_Iterator *it, void **data)
801 description for this color class. Let's bet on that for now. 802 description for this color class. Let's bet on that for now.
802 */ 803 */
803 cc = eina_hash_find(er->ed->file->color_hash, tuple->key); 804 cc = eina_hash_find(er->ed->file->color_hash, tuple->key);
804 if (!cc) return EINA_FALSE; 805 if (!cc) goto on_error;
805 et->cc.desc = cc->desc; 806 et->cc.desc = cc->desc;
806 807
807 *data = &et->cc; 808 *data = &et->cc;
808 return EINA_TRUE; 809 r = EINA_TRUE;
810
811 on_error:
812 eina_iterator_free(ith);
813 return r;
809} 814}
810 815
811static void * 816static void *