forked from enlightenment/efl
widget: Add null check
Summary: Adding NULL checking when allocate memory. Reviewers: Hermet, seoz, cedric Reviewed By: cedric Differential Revision: https://phab.enlightenment.org/D2663 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
d9712847be
commit
8677ef1add
|
@ -1645,6 +1645,11 @@ _elm_widget_event_callback_add(Eo *obj EINA_UNUSED, Elm_Widget_Smart_Data *sd, E
|
||||||
EINA_SAFETY_ON_NULL_RETURN(func);
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
||||||
|
|
||||||
Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data);
|
Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data);
|
||||||
|
if (!ecb)
|
||||||
|
{
|
||||||
|
ERR("Failed to allocate memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ecb->func = func;
|
ecb->func = func;
|
||||||
ecb->data = data;
|
ecb->data = data;
|
||||||
sd->event_cb = eina_list_append(sd->event_cb, ecb);
|
sd->event_cb = eina_list_append(sd->event_cb, ecb);
|
||||||
|
@ -5229,6 +5234,11 @@ _elm_widget_item_part_text_custom_set(Eo *eo_item EINA_UNUSED,
|
||||||
if (!label)
|
if (!label)
|
||||||
{
|
{
|
||||||
label = malloc(sizeof(Elm_Label_Data));
|
label = malloc(sizeof(Elm_Label_Data));
|
||||||
|
if (!label)
|
||||||
|
{
|
||||||
|
ERR("Failed to allocate memory");
|
||||||
|
return;
|
||||||
|
}
|
||||||
label->part = eina_stringshare_add(part);
|
label->part = eina_stringshare_add(part);
|
||||||
label->text = eina_stringshare_add(text);
|
label->text = eina_stringshare_add(text);
|
||||||
eina_hash_add(item->labels, part, label);
|
eina_hash_add(item->labels, part, label);
|
||||||
|
|
Loading…
Reference in New Issue