diff options
author | Jaehyun Cho <jae_hyun.cho@samsung.com> | 2019-01-30 12:03:20 +0000 |
---|---|---|
committer | Marcel Hollerbach <mail@marcel-hollerbach.de> | 2019-01-30 13:33:49 +0100 |
commit | 4eda1ea38ece822b5202fc03ad2309e85bd698b2 (patch) | |
tree | 975345decdd14433f8f57c90f5bf2396698998f4 | |
parent | fe29a7a06db2935d006643429c3b204afcdad1af (diff) | |
download | efl-4eda1ea38ece822b5202fc03ad2309e85bd698b2.tar.gz |
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
-rw-r--r-- | src/lib/eo/eo.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 44a17ae8a9..3e4ac6c3e5 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; } |