Change-Id: I63d6070426e1782484ba683979e16e3eff4d06fe
preference_is_existing("custom_wakeup_languages", &existing);
if (!existing) return -1;
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);
wakeup_words[sizeof(wakeup_words) - 1] = '\0';
LOGD("Custom wakeup words loaded : %s", wakeup_words);
+ 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);
wakeup_languages[sizeof(wakeup_languages) - 1] = '\0';
LOGD("Custom wakeup languages loaded : %s", wakeup_languages);
+ free(custom_wakeup_languages);
+ custom_wakeup_languages = NULL;
char *word_start = wakeup_words;
char *language_start = wakeup_languages;
char *word_start = wakeup_words;
char *language_start = wakeup_languages;