cedric pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=c5f40609db341ea75064eaf1d2b9fa324db6291d

commit c5f40609db341ea75064eaf1d2b9fa324db6291d
Author: Thiep Ha <thie...@gmail.com>
Date:   Thu Jun 11 12:05:52 2015 +0200

    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 <ced...@osg.samsung.com>
---
 src/lib/elm_widget.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

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);

-- 


Reply via email to