From ac09acd5080df05c4f3049b30bbc656c9dc21f39 Mon Sep 17 00:00:00 2001 From: Thiep Ha Date: Thu, 11 Jun 2015 09:46:36 +0100 Subject: [PATCH] Eo: Add Null check Summary: Add Null checking when allocate memory. Reviewers: cedric, tasn Reviewed By: tasn Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D2664 --- src/lib/eo/Eo.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index 02a5520..b9ef082 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -180,6 +180,8 @@ static inline Eo_Dbg_Info * EO_DBG_INFO_LIST_APPEND(Eo_Dbg_Info *list, const char *name) { Eo_Dbg_Info *tmp = (Eo_Dbg_Info *)calloc(1, sizeof(*tmp)); + + if (!tmp) return NULL; tmp->name = eina_stringshare_add(name); eina_value_list_setup(&(tmp->value), EO_DBG_INFO_TYPE); if (list) @@ -203,6 +205,8 @@ do { \ if (List) \ { \ Eo_Dbg_Info *Tmp = calloc(1, sizeof(*Tmp)); \ + \ + if (!Tmp) break; \ Tmp->name = eina_stringshare_add(NAME); \ eina_value_setup(&(Tmp->value), TYPE); \ eina_value_set(&(Tmp->value), VALUE); \ -- 2.7.4