From: sooyeon.kim Date: Thu, 10 Sep 2020 06:06:10 +0000 (+0900) Subject: Add to avoid a crash in player thread X-Git-Tag: accepted/tizen/unified/20200911.143431^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82a958a158d342bb7d1632b43385dd2e61925c63;p=platform%2Fcore%2Fuifw%2Ftts.git Add to avoid a crash in player thread Change-Id: I8aac7c19383a309e5c85cca501dcc842272c68db Signed-off-by: sooyeon.kim --- diff --git a/server/ttsd_player.c b/server/ttsd_player.c index 282a71e..ff0a15e 100644 --- a/server/ttsd_player.c +++ b/server/ttsd_player.c @@ -551,24 +551,22 @@ static void __play_thread(void *data, Ecore_Thread *thread) return; } - if (true == player->is_paused_data) { + if (true == player->is_paused_data && NULL != player->paused_data) { /* Resume player */ if (NULL != sound_data) { ttsd_data_clear_sound_data(&sound_data); } sound_data = (sound_data_s*)calloc(1, sizeof(sound_data_s)); - char* temp = (char*)calloc(player->paused_data->data_size + 5, sizeof(char)); - if (NULL == sound_data || NULL == temp || player->paused_data->data_size <= 0) { + if (NULL == sound_data || player->paused_data->data_size <= 0) { SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Out of memory OR paused_data is empty"); ttsd_data_clear_sound_data(&sound_data); - if (NULL != temp) { - free(temp); - temp = NULL; - } + sound_data = player->paused_data; player->paused_data = NULL; } else { // NULL != sound_data && NULL != temp && player->paused_data->data_size > 0 + char* temp = (char*)calloc(player->paused_data->data_size + 5, sizeof(char)); + SLOG(LOG_INFO, tts_tag(), "[Player INFO] Copy paused_data to sound_data"); sound_data->data = NULL; sound_data->rate = 0;