Summary: Add a logic for handling failed memory allocation to prevent null pointer exception
Test Plan: Run unit test cases
Reviewers: eagleeye, Jaehyun_Cho, Hermet, zmike, SanghyeonLee
Reviewed By: SanghyeonLee
Subscribers: SanghyeonLee, cedric, #committers, #reviewers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D7829
}
cb_data = calloc(1, sizeof(Efl_Ui_List_View_Precise_Layouter_Callback_Data));
+ if (!cb_data) return;
cb_data->pd = pd;
cb_data->item = item;
evas_object_event_callback_add(item->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_item_size_hint_change, cb_data);
{
Efl_Ui_List_View_Seg_Array_Node* node;
node = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array_Node) + pd->step_size*sizeof(Efl_Ui_List_View_Layout_Item*));
+ if (!node) return NULL;
node->first = first;
node->max = pd->step_size;
pd->root = (void*)eina_rbtree_inline_insert(EINA_RBTREE_GET(pd->root), EINA_RBTREE_GET(node),
_create_item_partial(Efl_Model* model)
{
Efl_Ui_List_View_Layout_Item* item = calloc(1, sizeof(Efl_Ui_List_View_Layout_Item));
+ if (!item) return NULL;
item->children = efl_ref(model);
return item;
}
efl_ui_list_view_seg_array_setup(int size)
{
Efl_Ui_List_View_Seg_Array *pd = calloc(1, sizeof(Efl_Ui_List_View_Seg_Array));
+ if (!pd) return NULL;
pd->step_size = size;
return pd;