Fix issue detected by static analysis tool 46/278646/4
authorJihoon Kim <jihoon48.kim@samsung.com>
Sun, 24 Jul 2022 08:01:18 +0000 (17:01 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 25 Jul 2022 01:48:46 +0000 (10:48 +0900)
Change-Id: Iba3c2542af7a18ccf2b765a2cc2847c2b5d50219
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/service_ipc_dbus.cpp
src/service_plugin.cpp

index d5cbcc3..915b1ed 100644 (file)
@@ -399,6 +399,8 @@ int CServiceIpcDbus::change_active_state(pid_t pid, int state, const char* wakeu
                DBUS_TYPE_INVALID)) {
                dbus_message_unref(msg);
                MAS_LOGE("[ERROR] Fail to append args");
+               free(temp_wakeup_word);
+               free(temp_wakeup_extra_data_desc);
                return -1;
        }
 
@@ -406,6 +408,8 @@ int CServiceIpcDbus::change_active_state(pid_t pid, int state, const char* wakeu
 
        if (1 != dbus_connection_send(mConnectionSender, msg, NULL)) {
                MAS_LOGE("[Dbus ERROR] Fail to Send");
+               free(temp_wakeup_word);
+               free(temp_wakeup_extra_data_desc);
                return -1; // MAS_ERROR_OPERATION_FAILED;
        } else {
                MAS_LOGI("[Dbus DEBUG] Success to Send activate message : %d %d", pid, state);
index a24989d..780390a 100644 (file)
@@ -183,7 +183,7 @@ static void process_wakeup_event_by_word_timer(void* data)
                if (extra_data)
                        memcpy(extra_data, param->extra_data, extra_data_length);
        }
-       std::string extra_data_desc{param->extra_data_desc};
+       std::string extra_data_desc{param->extra_data_desc ? param->extra_data_desc : ""};
        const char* appid = nullptr;
        int id = param->id;
        CServicePlugin* plugin = param->plugin;