cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0054ea9514bb44a67ddaaabe4e0f213f8b3d934e
commit 0054ea9514bb44a67ddaaabe4e0f213f8b3d934e Author: Srivardhan Hebbar <[email protected]> Date: Mon Oct 19 11:08:13 2015 -0700 edje: fix memory leak on realloc. Summary: Signed-off-by: Srivardhan Hebbar <[email protected]> Reviewers: cedric Differential Revision: https://phab.enlightenment.org/D3186 Signed-off-by: Cedric BAIL <[email protected]> --- src/lib/edje/edje_util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 9a1b446..aa77208 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -5639,7 +5639,7 @@ _edje_program_remove(Edje_Part_Collection *edc, Edje_Program *p) EAPI void _edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p) { - Edje_Program ***array; + Edje_Program ***array, **temp; unsigned int *count; if (!p->signal && !p->source) @@ -5671,8 +5671,16 @@ _edje_program_insert(Edje_Part_Collection *edc, Edje_Program *p) count = &edc->programs.fnmatch_count; } + temp = *array; *array = realloc(*array, sizeof (Edje_Program *) * (*count + 1)); - (*array)[(*count)++] = p; + if (*array) + { + (*array)[(*count)++] = p; + } + else + { + *array = temp; + } } const char * --
