From: Thiep Ha Date: Thu, 11 Jun 2015 10:05:52 +0000 (+0200) Subject: widget: Add null check X-Git-Tag: v1.15.0-alpha1~219 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5f40609db341ea75064eaf1d2b9fa324db6291d;p=platform%2Fupstream%2Felementary.git 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 --- diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 8ebb23f..09cd815 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -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); Elm_Event_Cb_Data *ecb = ELM_NEW(Elm_Event_Cb_Data); + if (!ecb) + { + ERR("Failed to allocate memory"); + return; + } ecb->func = func; ecb->data = data; 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) { label = malloc(sizeof(Elm_Label_Data)); + if (!label) + { + ERR("Failed to allocate memory"); + return; + } label->part = eina_stringshare_add(part); label->text = eina_stringshare_add(text); eina_hash_add(item->labels, part, label);