Fix memory leak
[platform/core/uifw/tts.git] / server / ttsd_server.c
index 03f1e5e..c99f4a3 100644 (file)
@@ -1209,6 +1209,14 @@ int ttsd_server_add_pcm(int uid, int event, void* data, int data_size, int audio
 
                if (0 != ttsd_data_add_sound_data(uid, temp_sound_data)) {
                        SECURE_SLOG(LOG_ERROR, tts_tag(), "[SERVER ERROR] Fail to add sound data : uid(%d)", uid);
+
+                       if (NULL != temp_sound_data->data) {
+                               free(temp_sound_data->data);
+                               temp_sound_data->data = NULL;
+                       }
+
+                       free(temp_sound_data);
+                       temp_sound_data = NULL;
                }
 
                if (0 != ttsd_player_play(uid)) {