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
This commit is contained in:
Hermet Park 2018-04-20 13:29:46 +09:00
parent 215b854b54
commit fd85423ae3
1 changed files with 2 additions and 2 deletions

View File

@ -174,13 +174,13 @@ ecore_timer_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(),