From 649efba05da2fbe83fcda493c2c19c82ab7055c1 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 12 Sep 2017 16:36:32 +0900 Subject: [PATCH] Fix issues detected by static analysis tool Passing a null pointer to internally called std::char_traits::length() Change-Id: I5a6cc71c8364ad255d35cd83aeff3948a55cd75f Signed-off-by: Jihoon Kim --- ism/extras/efl_panel/isf_panel_efl.cpp | 12 ++++++------ ism/src/isf_pkg.cpp | 23 +++++++++++++---------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ism/extras/efl_panel/isf_panel_efl.cpp b/ism/extras/efl_panel/isf_panel_efl.cpp index 7857d99..b14da48 100644 --- a/ism/extras/efl_panel/isf_panel_efl.cpp +++ b/ism/extras/efl_panel/isf_panel_efl.cpp @@ -6342,14 +6342,14 @@ static void update_ise_locale (const char *language) } else { char *lang_str = vconf_get_str (VCONFKEY_LANGSET); - if (lang_str && _locale_string.compare(lang_str) == 0) { - free (lang_str); - return; - } + if (lang_str) { + if (_locale_string.compare(lang_str) == 0) { + free (lang_str); + return; + } - strLang = String (lang_str); + strLang = String (lang_str); - if (lang_str) { free (lang_str); } } diff --git a/ism/src/isf_pkg.cpp b/ism/src/isf_pkg.cpp index 13cfc6d..7aca3a8 100644 --- a/ism/src/isf_pkg.cpp +++ b/ism/src/isf_pkg.cpp @@ -160,16 +160,19 @@ int isf_pkg_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data) ime_db.module_name = ime_db.pkgid; - String module_path = String (path) + String ("/lib"); - String fullpath = module_path + String (SCIM_PATH_DELIM_STRING) + ime_db.module_name + String (".so"); - struct stat st; - if (stat (fullpath.c_str (), &st) < 0) { - /* Not found in lib directory of package's root path */ - ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION) - + String (SCIM_PATH_DELIM_STRING) + String ("Helper"); - } - else { - ime_db.module_path = module_path; + if (path) + { + String module_path = String (path) + String ("/lib"); + String fullpath = module_path + String (SCIM_PATH_DELIM_STRING) + ime_db.module_name + String (".so"); + struct stat st; + if (stat (fullpath.c_str (), &st) < 0) { + /* Not found in lib directory of package's root path */ + ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION) + + String (SCIM_PATH_DELIM_STRING) + String ("Helper"); + } + else { + ime_db.module_path = module_path; + } } ime_db.is_enabled = 1; -- 2.7.4