From ff9b4775e8be65ee94a20ec6a13d5d2dcf7de86b Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Mon, 5 Aug 2013 15:32:12 +0100 Subject: [PATCH] Fix memleak in data_thread_script of edje_cc_out NB: If we are going to exit data_thread_script function due to malloc failure or fread failure, then we should close the previously fdopen'd file so that we do not leak 'f'. Signed-off-by: Chris Michael --- src/bin/edje/edje_cc_out.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index c5caf2f973..889d9a062d 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -1185,6 +1185,7 @@ data_thread_script(void *data, Ecore_Thread *thread EINA_UNUSED) sc->tmpo); sc->errstr = strdup(buf); free(dat); + fclose(f); return; } snprintf(buf, sizeof(buf), "edje/scripts/embryo/compiled/%i", @@ -1197,6 +1198,7 @@ data_thread_script(void *data, Ecore_Thread *thread EINA_UNUSED) snprintf(buf, sizeof(buf), "Alloc failed for %lu bytes", (unsigned long)size); sc->errstr = strdup(buf); + fclose(f); return; } }