Fix SVACE issue 46/104746/1 submit/tizen_3.0/20161214.100651
authorsooyeon.kim <sooyeon.kim@samsung.com>
Wed, 14 Dec 2016 07:58:27 +0000 (16:58 +0900)
committerSooyeon Kim <sooyeon.kim@samsung.com>
Wed, 14 Dec 2016 07:59:01 +0000 (23:59 -0800)
Change-Id: I263287fa4dcb7f1fe0ae3624608915b0f2460b24
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
client/tts.c

index 09f3892..05daf46 100644 (file)
@@ -445,7 +445,7 @@ int tts_set_server_tts(tts_h tts, const char* credential)
                return TTS_ERROR_NOT_SUPPORTED;
        }
 
-       if (NULL == tts || NULL == credential) {
+       if (NULL == tts) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Input parameter is null");
                return TTS_ERROR_INVALID_PARAMETER;
        }
@@ -467,19 +467,20 @@ int tts_set_server_tts(tts_h tts, const char* credential)
                client->credential = NULL;
        }
 
-       client->credential = strdup(credential);
-       if (NULL == client->credential) {
-               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to allocate memory");
-               return TTS_ERROR_OUT_OF_MEMORY;
-       }
-
        client->internal = true;
 
        char* key = NULL;
-       if (NULL != credential)
+       if (NULL != credential) {
                key = strdup("EnableServerTTS");
-       else
+               client->credential = strdup(credential);
+               if (NULL == client->credential) {
+                       SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to allocate memory");
+                       return TTS_ERROR_OUT_OF_MEMORY;
+               }
+       } else {
                key = strdup("DisableServerTTS");
+       }
+
        if (NULL == key) {
                SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to allocate memory");
                return TTS_ERROR_OUT_OF_MEMORY;