Fix svace and coverity issues 01/279001/3
authorsooyeon <sooyeon.kim@samsung.com>
Fri, 29 Jul 2022 06:00:12 +0000 (15:00 +0900)
committersooyeon <sooyeon.kim@samsung.com>
Fri, 29 Jul 2022 08:19:42 +0000 (17:19 +0900)
Change-Id: Ic72a37bbbd082b9cbb35f8cafdf9384a6cbd60d6
Signed-off-by: sooyeon <sooyeon.kim@samsung.com>
client/vc_mgr.c
client/vc_setting_tidl.c
client/vc_tidl.c
common/vc_info_parser.c
server/vcd_client_data.c
server/vcd_server.c
server/vcd_tidl.c

index e07325f..3746242 100644 (file)
@@ -34,7 +34,6 @@
 #include "vc_mgr_tidl.h"
 #include "vc_mgr_data.h"
 #include "vc_mgr_player.h"
-#include "voice_control.h"
 #include "voice_control_command.h"
 #include "voice_control_command_expand.h"
 #include "voice_control_common.h"
index 314daf9..e2c8b10 100644 (file)
@@ -73,6 +73,8 @@ static char* __get_engine_appid(void)
 
        SLOG(LOG_INFO, TAG_VCC, "[INFO] VC engine appid(%s)", appid);
 
+       free(engine_name);
+
        return appid;
 }
 
index 33d91a5..2601636 100644 (file)
@@ -82,6 +82,8 @@ static char* __get_engine_appid(void)
 
        SLOG(LOG_INFO, TAG_VCC, "[INFO] VC engine appid(%s)", appid);
 
+       free(engine_name);
+
        return appid;
 }
 
index 56ce84b..3e7ee27 100644 (file)
@@ -25,7 +25,6 @@
 #include "vc_info_parser.h"
 #include "vc_main.h"
 #include "voice_control_command.h"
-#include "voice_control_command_expand.h"
 #include "voice_control_common.h"
 
 
index 057d919..6620180 100644 (file)
@@ -22,7 +22,6 @@
 #include "vcd_config.h"
 #include "vcd_main.h"
 
-#include "voice_control_command_expand.h"
 
 /* Client list */
 static GSList* g_client_list = NULL;
index 8a21bcd..868a681 100644 (file)
@@ -1504,7 +1504,7 @@ static void __vcd_cleanup_client(vcd_client_type_e type)
        }
 
        if (0 == ret || mgr_pid > 0) {
-               SLOG(LOG_INFO, TAG_VCD, "@@@ Clean up %s client ", type ? (type == 1) ? "Widget" : "Manager" : "Normal");
+               SLOG(LOG_INFO, TAG_VCD, "@@@ Clean up %s client ", type ? (type == VCD_CLIENT_TYPE_WIDGET) ? "Widget" : "Manager" : "Normal");
                if (NULL != client_list && client_count > 0) {
                        for (i = 0; i < client_count; i++) {
                                exist = false;
@@ -1513,7 +1513,7 @@ static void __vcd_cleanup_client(vcd_client_type_e type)
                                        iter = g_list_nth(g_proc_list, j);
                                        if (NULL != iter) {
                                                if (*(client_list + i) == GPOINTER_TO_INT(iter->data)) {
-                                                       SLOG(LOG_INFO, TAG_VCD, "%s pid(%d) is running", type ? (type == 1) ? "Widget" : "Manager" : "Normal", *(client_list + i));
+                                                       SLOG(LOG_INFO, TAG_VCD, "%s pid(%d) is running", type ? (type == VCD_CLIENT_TYPE_WIDGET) ? "Widget" : "Manager" : "Normal", *(client_list + i));
                                                        exist = true;
                                                        break;
                                                }
@@ -1521,7 +1521,7 @@ static void __vcd_cleanup_client(vcd_client_type_e type)
                                }
 
                                if (false == exist) {
-                                       SLOG(LOG_ERROR, TAG_VCD, "%s pid(%d) should be removed", type ? (type == 1) ? "Widget" : "Manager" : "Normal", *(client_list + i));
+                                       SLOG(LOG_ERROR, TAG_VCD, "%s pid(%d) should be removed", type ? (type == VCD_CLIENT_TYPE_WIDGET) ? "Widget" : "Manager" : "Normal", *(client_list + i));
                                        if (VCD_CLIENT_TYPE_NORMAL == type)
                                                vcd_server_finalize(*(client_list + i));
                                        else if (VCD_CLIENT_TYPE_WIDGET == type)
index 967ad20..b7ed0b9 100644 (file)
@@ -253,6 +253,8 @@ void __send_signal(bundle* msg, vcd_client_type_e type)
                                }
                        }
                }
+
+               free(client_list);
                pthread_mutex_unlock(&g_client_tidl_info_mutex);
        } /* signal to clients */
        else if (VCD_CLIENT_TYPE_WIDGET == type) {
@@ -1921,6 +1923,8 @@ int vcdc_send_manager_pid(int manager_pid)
        ret = vcd_client_get_tidl_list(&client_list, &client_count);
        if (0 != ret || 0 == client_count) {
                SLOG(LOG_WARN, TAG_VCD, "[WARNING] There is no client");
+               if (NULL != client_list)
+                       free(client_list);
                return VCD_ERROR_NONE;
        }
 
@@ -1958,6 +1962,8 @@ int vcdc_send_manager_pid(int manager_pid)
                bundle_free(msg);
        }
 
+       free(client_list);
+
        return VCD_ERROR_NONE;
 }