From a0587234c44f725b11922ffc0afca5abfbbb4b08 Mon Sep 17 00:00:00 2001 From: sooyeon Date: Fri, 29 Jul 2022 15:00:12 +0900 Subject: [PATCH] Fix svace and coverity issues Change-Id: Ic72a37bbbd082b9cbb35f8cafdf9384a6cbd60d6 Signed-off-by: sooyeon --- client/vc_mgr.c | 1 - client/vc_setting_tidl.c | 2 ++ client/vc_tidl.c | 2 ++ common/vc_info_parser.c | 1 - server/vcd_client_data.c | 1 - server/vcd_server.c | 6 +++--- server/vcd_tidl.c | 6 ++++++ 7 files changed, 13 insertions(+), 6 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index e07325f..3746242 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -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" diff --git a/client/vc_setting_tidl.c b/client/vc_setting_tidl.c index 314daf9..e2c8b10 100644 --- a/client/vc_setting_tidl.c +++ b/client/vc_setting_tidl.c @@ -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; } diff --git a/client/vc_tidl.c b/client/vc_tidl.c index 33d91a5..2601636 100644 --- a/client/vc_tidl.c +++ b/client/vc_tidl.c @@ -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; } diff --git a/common/vc_info_parser.c b/common/vc_info_parser.c index 56ce84b..3e7ee27 100644 --- a/common/vc_info_parser.c +++ b/common/vc_info_parser.c @@ -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" diff --git a/server/vcd_client_data.c b/server/vcd_client_data.c index 057d919..6620180 100644 --- a/server/vcd_client_data.c +++ b/server/vcd_client_data.c @@ -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; diff --git a/server/vcd_server.c b/server/vcd_server.c index 8a21bcd..868a681 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -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) diff --git a/server/vcd_tidl.c b/server/vcd_tidl.c index 967ad20..b7ed0b9 100644 --- a/server/vcd_tidl.c +++ b/server/vcd_tidl.c @@ -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; } -- 2.7.4