/* Current language is not available */
SLOG(LOG_WARN, tts_tag(), "[Server WARNING] Fail to set voice : lang(%s), type(%d)", str_param, int_param);
}
- if (NULL != out_lang) free(out_lang);
+ if (NULL != out_lang) {
+ free(out_lang);
+ out_lang = NULL;
+ }
break;
}
int temp_type;
if (true != ttsd_engine_select_valid_voice((const char*)lang, voice_type, &temp_lang, &temp_type)) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to select valid voice");
- if (NULL != temp_lang) free(temp_lang);
+ if (NULL != temp_lang) {
+ free(temp_lang);
+ temp_lang = NULL;
+ }
return TTSD_ERROR_INVALID_VOICE;
}
speak_data = (speak_data_s*)calloc(1, sizeof(speak_data_s));
if (NULL == speak_data) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to allocate memory");
- if (NULL != temp_lang) free(temp_lang);
+ if (NULL != temp_lang) {
+ free(temp_lang);
+ temp_lang = NULL;
+ }
return TTSD_ERROR_OPERATION_FAILED;
}
SLOG(LOG_INFO, tts_tag(), "[Server] Add queue, lang(%s), vctype(%d), speed(%d), uttid(%d), credential(%s)", lang, voice_type, speed, utt_id, credential);
/* if state is APP_STATE_READY , APP_STATE_PAUSED , only need to add speak data to queue*/
- if (0 != ttsd_data_add_speak_data(uid, speak_data)) {
+ int ret = -1;
+ ret = ttsd_data_add_speak_data(uid, speak_data);
+ if (0 != ret) {
SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to add speak data");
- if (NULL != temp_lang) free(temp_lang);
+ if (NULL != temp_lang) {
+ free(temp_lang);
+ temp_lang = NULL;
+ }
if (NULL != speak_data) {
if (NULL != speak_data->lang) free(speak_data->lang);
if (NULL != speak_data->text) free(speak_data->text);
speak_data = NULL;
}
- return TTSD_ERROR_OPERATION_FAILED;
+ return ret;
}
if (0 != ttsd_data_set_used_voice(uid, temp_lang, temp_type)) {
}
}
- if (NULL != temp_lang) free(temp_lang);
+ if (NULL != temp_lang) {
+ free(temp_lang);
+ temp_lang = NULL;
+ }
if (APP_STATE_PLAYING == state) {
/* check if engine use network */