From: sungrae jo Date: Tue, 4 Feb 2020 07:00:05 +0000 (+0900) Subject: Fixed coverity issues X-Git-Tag: accepted/tizen/unified/20200211.132125~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2656b5a2447215deb20083781aef33e4bbbb036;p=platform%2Fcore%2Fuifw%2Fvoice-control.git Fixed coverity issues Change-Id: Iffa03a06750ce6c229d784b928d6910809e43c2c Signed-off-by: sungrae jo --- diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 310c57e..c32971a 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -130,6 +130,7 @@ static int __vc_db_exec_query(sqlite3* db_handle, const char* sql) if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] sqlite3_exec return fail, ret(%d), err(%s)", ret, err_msg); sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } return VC_DB_ERROR_NONE; @@ -160,6 +161,7 @@ static int __vc_db_check_table(sqlite3* db_handle, const char* table, bool *is_e if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] sqlite3_get_table return fail, ret(%d), err(%s)", ret, err_msg); sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } @@ -1557,6 +1559,8 @@ int __vc_db_open_db_for_daemon(char** path, sqlite3** db_handle) int ret = sqlite3_exec(*db_handle, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "sqlite3_exec returned %d: %s", ret, err_msg); + sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } } diff --git a/common/vc_command.c b/common/vc_command.c index 93ff07d..ebd9b8a 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -1986,6 +1986,8 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) if (0 > hour || 24 <= hour || (0 == flag && 12 < hour)) { SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); + free(tempstr); + tempstr = NULL; return VC_ERROR_NONE; } @@ -2017,6 +2019,8 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) if (0 > min || 60 <= min) { SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); + free(tempstr); + tempstr = NULL; return VC_ERROR_NONE; }