summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2017-08-07 13:09:07 +0900
committerJihoon Kim <jihoon48.kim@samsung.com>2017-08-07 13:09:10 +0900
commit7f145112e968ca1fc108baebeb474adf2294e5df (patch)
tree3c7b67ad0608a612a48d22b47a9cabde7c30d051
parent163b6da9c3c9fc614f607a62d1130e40a5f1e023 (diff)
downloadinputmethod-setting-7f145112e968ca1fc108baebeb474adf2294e5df.tar.gz
inputmethod-setting-7f145112e968ca1fc108baebeb474adf2294e5df.tar.bz2
inputmethod-setting-7f145112e968ca1fc108baebeb474adf2294e5df.zip
Fix issue detected by static analysis tool
Pointer 'id' returned from function 'calloc' at input_method_setting_list_ui.cpp:742 may be null, and it is dereferenced at input_method_setting_list_ui.cpp:743. Change-Id: I38a4c345e2fa6c979affb418fdfb143da2e0cd4d Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
-rw-r--r--im_setting_list/input_method_setting_list_ui.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/im_setting_list/input_method_setting_list_ui.cpp b/im_setting_list/input_method_setting_list_ui.cpp
index 02825b1..f9e5d68 100644
--- a/im_setting_list/input_method_setting_list_ui.cpp
+++ b/im_setting_list/input_method_setting_list_ui.cpp
@@ -740,21 +740,23 @@ static void im_setting_list_add_ime(void *data) {
g_gen_item_data.push_back(item_data);
id = (Item_Data *)calloc(sizeof(Item_Data), 1);
- id->index = i;
-
- id->item = elm_genlist_item_append(ad->genlist,
- itc_im_list_keyboard_list,
- id,
- NULL,
- ELM_GENLIST_ITEM_NONE,
- im_setting_list_item_sel_cb,
- (void *)(i));
+ if (id) {
+ id->index = i;
+
+ id->item = elm_genlist_item_append(ad->genlist,
+ itc_im_list_keyboard_list,
+ id,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ im_setting_list_item_sel_cb,
+ (void *)(i));
+
+ if (g_ime_info_list[i].is_preinstalled || (i == g_active_ime_index)) {
+ elm_object_item_disabled_set(id->item, EINA_TRUE);
+ }
- if (g_ime_info_list[i].is_preinstalled || (i == g_active_ime_index)) {
- elm_object_item_disabled_set(id->item, EINA_TRUE);
+ g_gen_item_data[i].gen_item = id->item;
}
-
- g_gen_item_data[i].gen_item = id->item;
}
#endif