From f532f6e7f49629e818d4e1aae8c17ecc36cac106 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 14 Dec 2016 10:34:24 +0900 Subject: [PATCH 1/1] Fix memory leak and Delete an unnecessary file Change-Id: I7037f7e91c98b2a0b9f75c6159778cde1fe256da Signed-off-by: sooyeon.kim --- common/stt_config_parser.c | 2 ++ server/sttd_main.c | 85 ---------------------------------------------- 2 files changed, 2 insertions(+), 85 deletions(-) delete mode 100644 server/sttd_main.c diff --git a/common/stt_config_parser.c b/common/stt_config_parser.c index 50de74c..7221d3b 100644 --- a/common/stt_config_parser.c +++ b/common/stt_config_parser.c @@ -942,6 +942,7 @@ 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); + xmlFreeDoc(doc); return -1; } @@ -970,6 +971,7 @@ int stt_parser_get_time_info(GSList** time_list) if (NULL == temp_info) { SLOG(LOG_ERROR, stt_tag(), "[ERROR] Memory alloc error!!"); + xmlFreeDoc(doc); return -1; } diff --git a/server/sttd_main.c b/server/sttd_main.c deleted file mode 100644 index 6160f9f..0000000 --- a/server/sttd_main.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -* 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 -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#include - -#include "stt_defs.h" -#include "stt_network.h" -#include "sttd_dbus.h" -#include "sttd_main.h" -#include "sttd_server.h" - - -#define CLIENT_CLEAN_UP_TIME 500 - -static Ecore_Timer* g_check_client_timer = NULL; - -int main(int argc, char** argv) -{ - SLOG(LOG_DEBUG, TAG_STTD, " "); - SLOG(LOG_DEBUG, TAG_STTD, " "); - SLOG(LOG_DEBUG, TAG_STTD, "===== STT Daemon Initialize"); - - if (!ecore_init()) { - SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize Ecore"); - return EXIT_FAILURE; - } - - if (0 != sttd_dbus_open_connection()) { - SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to open connection"); - return EXIT_FAILURE; - } - - if (0 != sttd_initialize()) { - SLOG(LOG_ERROR, TAG_STTD, "[ERROR] Fail to initialize stt-daemon"); - return EXIT_FAILURE; - } - - stt_network_initialize(); - - g_check_client_timer = ecore_timer_add(CLIENT_CLEAN_UP_TIME, sttd_cleanup_client, NULL); - if (NULL == g_check_client_timer) { - SLOG(LOG_WARN, TAG_STTD, "[Main Warning] Fail to create timer of client check"); - } - - SLOG(LOG_DEBUG, TAG_STTD, "[Main] stt-daemon start..."); - - SLOG(LOG_DEBUG, TAG_STTD, "====="); - SLOG(LOG_DEBUG, TAG_STTD, " "); - SLOG(LOG_DEBUG, TAG_STTD, " "); - - ecore_main_loop_begin(); - - SLOG(LOG_DEBUG, TAG_STTD, "===== STT Daemon Finalize"); - - if (NULL != g_check_client_timer) { - ecore_timer_del(g_check_client_timer); - } - - sttd_dbus_close_connection(); - - stt_network_finalize(); - - sttd_finalize(); - - ecore_shutdown(); - - SLOG(LOG_DEBUG, TAG_STTD, "====="); - SLOG(LOG_DEBUG, TAG_STTD, " "); - SLOG(LOG_DEBUG, TAG_STTD, " "); - - return 0; -} - - - -- 2.7.4