Add line coverage tags
[platform/core/uifw/tts.git] / client / tts_client.c
index bd03627..94a713d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-*  Copyright (c) 2011-2014 Samsung Electronics Co., Ltd All Rights Reserved 
+*  Copyright (c) 2011-2016 Samsung Electronics Co., Ltd All Rights Reserved 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
@@ -77,6 +77,18 @@ int tts_client_new(tts_h* tts)
 
        client->cb_ref_count = 0;
 
+       client->utt_id = 0;
+       client->reason = 0;
+       client->err_msg = NULL;
+
+       client->conn_timer = NULL;
+
+       client->credential = NULL;
+       client->credential_needed = false;
+       client->internal = false;
+
+       client->text_repeat = NULL;
+
        g_client_list = g_list_append(g_client_list, client);
 
        *tts = temp;
@@ -91,7 +103,7 @@ int tts_client_destroy(tts_h tts)
        if (tts == NULL) {
                SLOG(LOG_ERROR, TAG_TTSC, "Input parameter is NULL");
                return TTS_ERROR_INVALID_PARAMETER;
-       }       
+       }
 
        GList *iter = NULL;
        tts_client_s *data = NULL;
@@ -109,9 +121,31 @@ int tts_client_destroy(tts_h tts)
                                while (0 != data->cb_ref_count) {
                                        /* wait for release callback function */
                                }
+
+                               if (NULL != data->err_msg) {
+                                       free(data->err_msg);
+                                       data->err_msg = NULL;
+                               }
+
+                               if (NULL != data->credential) {
+                                       free(data->credential);
+                                       data->credential = NULL;
+                               }
+
+                               if (NULL != data->text_repeat) {
+                                       free(data->text_repeat);
+                                       data->text_repeat = NULL;
+                               }
+
                                free(data);
                                free(tts);
 
+                               data = NULL;
+                               tts = NULL;
+
+                               SLOG(LOG_DEBUG, TAG_TTSC, "Client destroy");
+                               g_list_free(iter);
+
                                return TTS_ERROR_NONE;
                        }
 
@@ -206,6 +240,7 @@ int tts_client_get_use_callback(tts_client_s* client)
        return client->cb_ref_count;
 }
 
+//LCOV_EXCL_START
 int tts_client_get_connected_client_count()
 {
        GList *iter = NULL;
@@ -255,4 +290,5 @@ int tts_client_get_mode_client_count(tts_mode_e mode)
 GList* tts_client_get_client_list()
 {
        return g_client_list;
-}
\ No newline at end of file
+}
+//LCOV_EXCL_STOP