elm: resolve possible memory leak.

@fix
This commit is contained in:
JongMin Lee 2018-04-20 15:41:32 +09:00 committed by Hermet Park
parent a42451d688
commit a07d729b2f
1 changed files with 12 additions and 4 deletions

View File

@ -618,16 +618,16 @@ elm_drop_item_container_add(Evas_Object *obj,
{
Eo *sel_man = _selection_manager_get(obj);
int seatid = 1;
Dnd_Drag_State *enter, *leave;
Dnd_Cont_Drag_Pos *pos;
Dnd_Cont_Drop *drop;
Dnd_Drag_State *enter = NULL, *leave = NULL;
Dnd_Cont_Drag_Pos *pos = NULL;
Dnd_Cont_Drop *drop = NULL;
Eina_List *cont_drop_list;
enter = calloc(1, sizeof(Dnd_Drag_State));
leave = calloc(1, sizeof(Dnd_Drag_State));
pos = calloc(1, sizeof(Dnd_Cont_Drag_Pos));
drop = calloc(1, sizeof(Dnd_Cont_Drop));
if (!enter || !leave || !pos || !drop) return EINA_FALSE;
if (!enter || !leave || !pos || !drop) goto on_error;
#ifdef HAVE_ELEMENTARY_WL2
seatid = _wl_default_seat_id_get(obj);
#endif
@ -665,6 +665,14 @@ elm_drop_item_container_add(Evas_Object *obj,
seatid);
return EINA_TRUE;
on_error:
if (enter) free(enter);
if (leave) free(leave);
if (pos) free(pos);
if (drop) free(drop);
return EINA_FALSE;
}
EAPI Eina_Bool