From: Jaehyun Cho Date: Wed, 30 Jan 2019 12:03:20 +0000 (+0000) Subject: eo: check memory allocation of table data X-Git-Tag: accepted/tizen/unified/20190201.061426~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad18d2a48ff178a4fac1616a528a496c5b8928b7;p=platform%2Fupstream%2Fefl.git eo: check memory allocation of table data Memory allocation is checked for the given domain's table data like other cases for main and shared table data. Differential Revision: https://phab.enlightenment.org/D7810 --- diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 44a17ae..3e4ac6c 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -2470,21 +2470,26 @@ EAPI Eina_Bool efl_domain_switch(Efl_Id_Domain domain) { Eo_Id_Data *data = _eo_table_data_get(); + Eo_Id_Data *new_data; if ((domain < EFL_ID_DOMAIN_MAIN) || (domain > EFL_ID_DOMAIN_THREAD) || (domain == EFL_ID_DOMAIN_SHARED)) { ERR("Invalid domain %i being switched to", domain); return EINA_FALSE; } - if (data) + if ((data) && (data->local_domain == domain)) + return EINA_TRUE; + + new_data = _eo_table_data_new(domain); + if (!new_data) { - if (data->local_domain == domain) return EINA_TRUE; - _eo_free_ids_tables(data); + ERR("Could not allocate domain %i table data", domain); + return EINA_FALSE; } - data = _eo_table_data_new(domain); - data->local_domain = domain; - data->domain_stack[data->stack_top] = domain; - eina_tls_set(_eo_table_data, data); + if (data) _eo_free_ids_tables(data); + new_data->local_domain = domain; + new_data->domain_stack[new_data->stack_top] = domain; + eina_tls_set(_eo_table_data, new_data); return EINA_TRUE; }