Fix PASSED_TO_PROC_AFTER_FREE issue
[platform/core/uifw/tts.git] / common / tts_config_mgr.c
index 1304fc0..8259e2c 100755 (executable)
@@ -771,6 +771,9 @@ int __tts_config_mgr_get_engine_info()
                        }
 
                        if (NULL != dirp) {
+                               if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name))
+                                       continue;
+
                                filesize = strlen(TTS_DEFAULT_ENGINE_INFO) + strlen(dirp->d_name) + 2;
                                if (filesize >= 512) {
                                        SECURE_SLOG(LOG_ERROR, tts_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
@@ -810,6 +813,9 @@ int __tts_config_mgr_get_engine_info()
                        }
 
                        if (NULL != dirp) {
+                               if (!strcmp(".", dirp->d_name) || !strcmp("..", dirp->d_name))
+                                       continue;
+
                                filesize = strlen(TTS_DOWNLOAD_ENGINE_INFO) + strlen(dirp->d_name) + 2;
                                if (filesize >= 512) {
                                        SECURE_SLOG(LOG_ERROR, tts_tag(), "[CONFIG ERROR] File path is too long : %s", dirp->d_name);
@@ -1497,12 +1503,11 @@ int tts_config_mgr_set_engine(const char* engine)
 
                g_config_info->engine_id = strdup(engine);
 
-               if (NULL != g_config_info->setting) {
-                       free(g_config_info->setting);
-                       g_config_info->setting = NULL;
-               }
-
                if (NULL != engine_info->setting) {
+                       if (NULL != g_config_info->setting) {
+                               free(g_config_info->setting);
+                               g_config_info->setting = NULL;
+                       }
                        g_config_info->setting = strdup(engine_info->setting);
                }