summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2018-04-09 11:46:13 +0900
committerHermet Park <hermetpark@gmail.com>2018-04-09 11:46:13 +0900
commit3a4baabaaa6b5b3e3e8f30b1e54e6968e364086f (patch)
tree594e5e4639173700e6f2bd668d1acbf830d8a31b
parentecc8b479bdbb52dc91b3a163f4d126682f29615b (diff)
ecore: fix a potential memory leak.
if the func argument is null, allocated memory won't be freed properly. return it as soon as possible. @fix
-rw-r--r--src/lib/ecore/ecore_timer.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/ecore/ecore_timer.c b/src/lib/ecore/ecore_timer.c
index b1b9a99052..ed75b05a5f 100644
--- a/src/lib/ecore/ecore_timer.c
+++ b/src/lib/ecore/ecore_timer.c
@@ -197,13 +197,13 @@ ecore_timer_loop_add(double in, Ecore_Task_Cb func, const void *data)
197 Eo *timer; 197 Eo *timer;
198 198
199 EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL); 199 EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
200 legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
201 if (!legacy) return NULL;
202 if (!func) 200 if (!func)
203 { 201 {
204 ERR("Callback function must be set up for the class."); 202 ERR("Callback function must be set up for the class.");
205 return NULL; 203 return NULL;
206 } 204 }
205 legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
206 if (!legacy) return NULL;
207 legacy->func = func; 207 legacy->func = func;
208 legacy->data = data; 208 legacy->data = data;
209 timer = efl_add(MY_CLASS, efl_main_loop_get(), 209 timer = efl_add(MY_CLASS, efl_main_loop_get(),