Fix defects detected by static analysis 27/245427/2 accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.105319 accepted/tizen/6.0/unified/hotfix/20201103.000329 accepted/tizen/unified/20201009.090830 submit/tizen/20201008.114127 submit/tizen/20201008.114429 submit/tizen_6.0/20201029.205501 submit/tizen_6.0_hotfix/20201102.192901 submit/tizen_6.0_hotfix/20201103.115101 tizen_6.0.m2_release
authorwn.jang <wn.jang@samsung.com>
Thu, 8 Oct 2020 10:28:55 +0000 (19:28 +0900)
committerwn.jang <wn.jang@samsung.com>
Thu, 8 Oct 2020 10:57:04 +0000 (19:57 +0900)
Change-Id: Idff4c4459165f19351b81d1d275a41c7fc498a06

client/stt.c

index 90d8dec..2c7b22a 100644 (file)
@@ -1220,9 +1220,15 @@ int stt_foreach_supported_languages(stt_h stt, stt_supported_language_cb callbac
 
        if (NULL == client->current_engine_id) {
                ret = stt_config_mgr_get_engine(&current_engine_id);
+               if (NULL == current_engine_id) {
+                       SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to allocate memory or Engine id is NULL");
+                       return STT_ERROR_OPERATION_FAILED;
+               }
                ret = __stt_convert_config_error_code(ret);
                if (0 != ret) {
                        SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Fail to get default engine id : %s", __stt_get_error_code(ret)); //LCOV_EXCL_LINE
+                       free(current_engine_id);
+                       current_engine_id = NULL;
                        return ret;
                }
        } else {