diff --git a/src/lib/elementary/efl_ui_dnd.c b/src/lib/elementary/efl_ui_dnd.c index f40827812a..dacb07659d 100644 --- a/src/lib/elementary/efl_ui_dnd.c +++ b/src/lib/elementary/efl_ui_dnd.c @@ -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