Fix issue detected by static analysis tool 19/226119/2
authorInHong Han <inhong1.han@samsung.com>
Thu, 27 Feb 2020 04:17:04 +0000 (13:17 +0900)
committerInHong Han <inhong1.han@samsung.com>
Thu, 27 Feb 2020 04:20:14 +0000 (13:20 +0900)
Change-Id: I349b60ae94fa18a15c0d6f5329f8f394d1004cae

src/w-input-selector.cpp

index 1658c9d..4f5422c 100644 (file)
@@ -586,7 +586,8 @@ void set_source_caller_app_id(app_control_h app_control)
 
        if (caller){
                PRINTFUNC(DLOG_DEBUG, "caller = %s", caller);
-               app_control_add_extra_data(app_control, "caller_appid", caller);
+               if (app_control_add_extra_data(app_control, "caller_appid", caller) != APP_CONTROL_ERROR_NONE)
+                       LOGE("app_control_add_extra_data() is failed");
                free(caller);
        }
 }
@@ -600,18 +601,29 @@ void reply_to_sender_by_callback(const char *value, const char *type, const char
        if (app_control_create(&app_control) == 0) {
                int ret;
 
-               if (value)
-                       app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, value);
+               if (value) {
+                       ret = app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, value);
+                       if (ret != APP_CONTROL_ERROR_NONE)
+                               LOGE("app_control_add_extra_data() is failed : %d", ret);
+               }
 
-               if (type)
-                       app_control_add_extra_data(app_control, "reply_type", type);
+               if (type) {
+                       ret = app_control_add_extra_data(app_control, "reply_type", type);
+                       if (ret != APP_CONTROL_ERROR_NONE)
+                               LOGE("app_control_add_extra_data() is failed : %d", ret);
+               }
 
                if (path != NULL) {
-                       app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
+                       ret = app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
+                       if (ret != APP_CONTROL_ERROR_NONE)
+                               LOGE("app_control_add_extra_data_array() is failed : %d", ret);
                }
 
-               if (cursor_position != NULL)
-                       app_control_add_extra_data(app_control, "cursor_position_get", cursor_position);
+               if (cursor_position != NULL) {
+                       ret = app_control_add_extra_data(app_control, "cursor_position_get", cursor_position);
+                       if (ret != APP_CONTROL_ERROR_NONE)
+                               LOGE("app_control_add_extra_data() is failed : %d", ret);
+               }
 
                set_source_caller_app_id(app_control);
 
@@ -634,7 +646,9 @@ void reply_to_sender_by_callback_for_back()
        if (app_control_create(&app_control) == 0) {
                int ret;
 
-               app_control_add_extra_data(app_control, "back_to_composer", "yes");
+               ret = app_control_add_extra_data(app_control, "back_to_composer", "yes");
+               if (ret != APP_CONTROL_ERROR_NONE)
+                       LOGE("app_control_add_extra_data() is failed : %d", ret);
 
                ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
                if (ret != APP_CONTROL_ERROR_NONE)
@@ -1338,11 +1352,17 @@ void _app_service(app_control_h service, void* user_data)
        char **user_template_array = NULL;
        int user_template_array_len = -1;
 
-       app_control_clone(&(app_data->source_app_control), service);
+       ret = app_control_clone(&(app_data->source_app_control), service);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               LOGE("app_control_clone() is failed : %d", ret);
+
        app_data->reply_type = REPLY_APP_NORMAL;
        app_data->mime_type = MIME_TYPE_ALL;
 
        ret = app_control_get_extra_data_array(service, "user_template", &user_template_array, &user_template_array_len);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               LOGE("app_control_get_extra_data_array() is failed : %d", ret);
+
        g_input_template_data.input_template_array = user_template_array;
        g_input_template_data.input_template_array_len = user_template_array_len;
 
@@ -1385,8 +1405,13 @@ void _app_service(app_control_h service, void* user_data)
        }
 
        ret = app_control_is_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &is_extra_data_array);
+       if (ret != APP_CONTROL_ERROR_NONE)
+               LOGE("app_control_is_extra_data_array() is failed : %d", ret);
+
        if ( is_extra_data_array == true) {
                ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len);
+               if (ret != APP_CONTROL_ERROR_NONE)
+                       LOGE("app_control_get_extra_data_array() is failed : %d", ret);
                g_input_type_data.input_type_array = input_type_array;
                g_input_type_data.input_type_array_len = input_type_array_len;
        } else {