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
This commit is contained in:
Thiep Ha 2015-06-11 09:46:36 +01:00 committed by Tom Hacohen
parent 26b27319b4
commit ac09acd508
1 changed files with 4 additions and 0 deletions

View File

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