From: Ji-hoon Lee Date: Mon, 29 Mar 2021 02:02:10 +0000 (+0900) Subject: Fix defects detected by static analysis tool X-Git-Tag: submit/tizen/20210330.042720^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4cbdeeaa6b15602df3e9bacf53e4295cf39ad602;p=platform%2Fcore%2Fuifw%2Fmulti-assistant-service.git Fix defects detected by static analysis tool Change-Id: I63d6070426e1782484ba683979e16e3eff4d06fe --- diff --git a/src/service_config.cpp b/src/service_config.cpp index 2f2bc27..cdf1687 100644 --- a/src/service_config.cpp +++ b/src/service_config.cpp @@ -311,20 +311,23 @@ int CServiceConfig::load_custom_wake_words(const char* app_id, preference_is_existing("custom_wakeup_languages", &existing); if (!existing) return -1; - char* value = NULL; - preference_get_string("custom_wakeup_words", &value); - if (NULL == value) return -1; - strncpy(wakeup_words, value, sizeof(wakeup_words) - 1); + char* custom_wakeup_words = NULL; + preference_get_string("custom_wakeup_words", &custom_wakeup_words); + if (NULL == custom_wakeup_words) return -1; + strncpy(wakeup_words, custom_wakeup_words, sizeof(wakeup_words) - 1); wakeup_words[sizeof(wakeup_words) - 1] = '\0'; LOGD("Custom wakeup words loaded : %s", wakeup_words); - free(value); + free(custom_wakeup_words); + custom_wakeup_words = NULL; - preference_get_string("custom_wakeup_languages", &value); - if (NULL == value) return -1; - strncpy(wakeup_languages, value, sizeof(wakeup_languages) - 1); + char* custom_wakeup_languages = NULL; + preference_get_string("custom_wakeup_languages", &custom_wakeup_languages); + if (NULL == custom_wakeup_languages) return -1; + strncpy(wakeup_languages, custom_wakeup_languages, sizeof(wakeup_languages) - 1); wakeup_languages[sizeof(wakeup_languages) - 1] = '\0'; LOGD("Custom wakeup languages loaded : %s", wakeup_languages); - free(value); + free(custom_wakeup_languages); + custom_wakeup_languages = NULL; char *word_start = wakeup_words; char *language_start = wakeup_languages;