hermet pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=3a4baabaaa6b5b3e3e8f30b1e54e6968e364086f

commit 3a4baabaaa6b5b3e3e8f30b1e54e6968e364086f
Author: Hermet Park <hermetp...@gmail.com>
Date:   Mon Apr 9 11:46:13 2018 +0900

    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
---
 src/lib/ecore/ecore_timer.c | 4 ++--
 1 file 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)
    Eo *timer;
 
    EINA_MAIN_LOOP_CHECK_RETURN_VAL(NULL);
-   legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
-   if (!legacy) return NULL;
    if (!func)
      {
         ERR("Callback function must be set up for the class.");
         return NULL;
      }
+   legacy = calloc(1, sizeof (Ecore_Timer_Legacy));
+   if (!legacy) return NULL;
    legacy->func = func;
    legacy->data = data;
    timer = efl_add(MY_CLASS, efl_main_loop_get(),

-- 


Reply via email to