From 926c7e035a433f29fb087f397bca1a5441ab2ac6 Mon Sep 17 00:00:00 2001 From: Suyeon Hwang Date: Thu, 11 May 2017 17:22:32 +0900 Subject: [PATCH] Fix memory leak Change-Id: I0d2971545128ca20df768c2f6b4379441a2bcfb8 Signed-off-by: Suyeon Hwang --- server/ttsd_server.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/ttsd_server.c b/server/ttsd_server.c index 03f1e5e..c99f4a3 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -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)) { -- 2.7.4