Merge remote-tracking branch 'origin/tizen_3.0' into tizen
[platform/core/uifw/tts.git] / server / ttsd_server.c
old mode 100755 (executable)
new mode 100644 (file)
index d87437f..8820904
@@ -373,7 +373,10 @@ void __config_changed_cb(tts_config_type_e type, const char* str_param, int int_
                        /* 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;
        }
 
@@ -703,7 +706,10 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
        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;
        }
 
@@ -716,7 +722,10 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int 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;
        }
 
@@ -731,9 +740,14 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
        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);
@@ -745,7 +759,7 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
                        speak_data = NULL;
                }
 
-               return TTSD_ERROR_OPERATION_FAILED;
+               return ret;
        }
 
        if (0 != ttsd_data_set_used_voice(uid, temp_lang, temp_type)) {
@@ -756,7 +770,10 @@ int ttsd_server_add_queue(int uid, const char* text, const char* lang, int voice
                }
        }
 
-       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 */