Fix issue detected by static analysis tool 45/278645/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Sun, 24 Jul 2022 07:54:51 +0000 (16:54 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Sun, 24 Jul 2022 07:55:17 +0000 (16:55 +0900)
Calling app_get_id without checking return value (as is done elsewhere 7 out of 8 times).

Change-Id: I788f407ba70fef89c2c4951d588c0e8a73b1c5c5
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/sclcoreimpl.cpp

index 63cecd4..a04e18d 100644 (file)
@@ -71,14 +71,17 @@ sclboolean CSCLCoreImpl::prepare()
 
     if (!m_uuid) {
         char *appid = NULL;
-        app_get_id(&appid);
-
-        LOGD("appid : '%s'\n", appid);
-
-        if (appid) {
-            m_uuid = strdup(appid);
-            free(appid);
+        int app_ret = app_get_id(&appid);
+        if (app_ret == APP_ERROR_NONE) {
+            LOGD("appid : '%s'\n", appid);
+
+            if (appid) {
+                m_uuid = strdup(appid);
+                free(appid);
+            }
         }
+        else
+            LOGW("Failed to get app id(%d)", app_ret);
     }
 
     if (!m_window_creation_defer_flag) {
@@ -482,4 +485,4 @@ void CSCLCoreImpl::send_key_event_processing_result(scim::KeyEvent &key, sclu32
 void CSCLCoreImpl::set_dotnet_flag(sclboolean flag)
 {
     m_core_ui.set_dotnet_flag(flag);
-}
\ No newline at end of file
+}