X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=common%2Fstt_config_parser.c;h=aba6692afd12219b6340ade7a57a049fd3059d2d;hb=228c936b90ad516c06a60920b6555cde29254d7f;hp=7221d3be16b1c34665f618a67ecfcc5c89b89c35;hpb=f532f6e7f49629e818d4e1aae8c17ecc36cac106;p=platform%2Fcore%2Fuifw%2Fstt.git diff --git a/common/stt_config_parser.c b/common/stt_config_parser.c index 7221d3b..aba6692 100644 --- a/common/stt_config_parser.c +++ b/common/stt_config_parser.c @@ -896,6 +896,20 @@ int stt_parser_set_time_info(GSList* time_list) return 0; } +void __stt_parser_time_info_free(void* data) +{ + stt_result_time_info_s* time_info = (stt_result_time_info_s*)data; + + if (NULL != time_info) { + if (NULL != time_info->text) { + free(time_info->text); + time_info->text = NULL; + } + + free(time_info); + } +} + int stt_parser_get_time_info(GSList** time_list) { if (NULL == time_list) { @@ -942,6 +956,11 @@ int stt_parser_get_time_info(GSList** time_list) key = xmlGetProp(cur, (const xmlChar*)STT_TAG_TIME_COUNT); if (NULL == key) { SLOG(LOG_ERROR, stt_tag(), "[ERROR] <%s> has no content", STT_TAG_TIME_COUNT); + + if (NULL != temp_time_list) { + g_slist_free_full(temp_time_list, __stt_parser_time_info_free); + temp_time_list = NULL; + } xmlFreeDoc(doc); return -1; } @@ -971,6 +990,11 @@ int stt_parser_get_time_info(GSList** time_list) if (NULL == temp_info) { SLOG(LOG_ERROR, stt_tag(), "[ERROR] Memory alloc error!!"); + + if (NULL != temp_time_list) { + g_slist_free_full(temp_time_list, __stt_parser_time_info_free); + temp_time_list = NULL; + } xmlFreeDoc(doc); return -1; }