From e1460e579dafeca22001237356fdfcd3cd2b4568 Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Tue, 25 May 2021 19:22:25 +0900 Subject: [PATCH] Fix defects detected by static analysis tool Change-Id: I69a5ebb8595610b00c162ec6401ea29d357407e8 --- assistant-parser/src/ma_assistant_parser.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/assistant-parser/src/ma_assistant_parser.c b/assistant-parser/src/ma_assistant_parser.c index adc1e63..51710b5 100644 --- a/assistant-parser/src/ma_assistant_parser.c +++ b/assistant-parser/src/ma_assistant_parser.c @@ -299,11 +299,9 @@ static int __remove_assistant_info_xml(const char *pkgid, gchar *ut, uid_t uid) char path[256] = {'\0',}; snprintf(path, 256, "%s/%s.xml", dir_assistant_info, pkgid); - if (0 == access(path, F_OK)) { - LOGD("Remove assistant info xml(%s)", path); - if (0 != remove(path)) { - LOGE("[ERROR] Fail to remove assistant info xml(%s)", path); - } + LOGD("Remove assistant info xml(%s)", path); + if (0 != remove(path)) { + LOGE("[ERROR] Fail to remove assistant info xml(%s)", path); } FREE(dir_assistant_info) @@ -643,6 +641,10 @@ int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgid, const char *appid, GList * if (NULL != home_dir) { LOGD("[DEBUG] uid(%d), gid(%d), user_type(%s), home_dir(%s)", uid, gid, user_type, home_dir); + FREE(g_dir_config_base) + FREE(g_dir_home) + FREE(g_dir_assistant_base) + FREE(g_dir_assistant_info) g_dir_config_base = (char*)calloc(strlen(home_dir) + 23, sizeof(char)); g_dir_home = (char*)calloc(strlen(home_dir) + 26, sizeof(char)); g_dir_assistant_base = (char*)calloc(strlen(home_dir) + 30, sizeof(char)); @@ -956,6 +958,7 @@ int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgid, const char *appid, GList printf("[Parser Debug][DEBUG] TZ_USER_HOME: %s", tzplatform_mkstr(TZ_USER_HOME, "/")); } + FREE(g_dir_assistant_info); g_dir_assistant_info = strdup(MA_ASSISTANT_INFO); if (NULL == g_dir_assistant_info) { LOGE("[ERROR] Fail to allocate memory"); -- 2.34.1