Add logs to check removing config xml 55/190155/3 accepted/tizen/5.0/unified/20181102.023225 accepted/tizen/unified/20180928.080628 submit/tizen/20180927.113904 submit/tizen_5.0/20181101.000005
authorsooyeon.kim <sooyeon.kim@samsung.com>
Thu, 27 Sep 2018 10:50:37 +0000 (19:50 +0900)
committersooyeon.kim <sooyeon.kim@samsung.com>
Thu, 27 Sep 2018 11:34:40 +0000 (20:34 +0900)
Change-Id: I3c909b0d81259df8a23b58d52a5a3fe36e22c255
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
common/tts_config_parser.c

index 42cfad0..1cbdec8 100644 (file)
@@ -77,14 +77,14 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
 
        cur = xmlDocGetRootElement(doc);
        if (cur == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document. doc path(%s, %p)", path, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
        }
 
        if (xmlStrcmp(cur->name, (const xmlChar *)TTS_TAG_ENGINE_BASE_TAG)) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT 'tts-engine'");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT 'tts-engine'. doc path(%s, %p)", path, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -92,7 +92,7 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
 
        cur = cur->xmlChildrenNode;
        if (cur == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document. doc path(%s, %p)", path, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -102,7 +102,7 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
        tts_engine_info_s* temp;
        temp = (tts_engine_info_s*)calloc(1, sizeof(tts_engine_info_s));
        if (NULL == temp) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory. doc path(%s, %p)", path, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -236,8 +236,11 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info
                temp->text_size = TTS_MAX_TEXT_SIZE;
        }
 
-       xmlFreeDoc(doc);
-       doc = NULL;
+       if (NULL != doc) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] doc path(%s, %p)", path, doc);
+               xmlFreeDoc(doc);
+               doc = NULL;
+       }
 
        if (NULL == temp->uuid) {
                /* Invalid engine */
@@ -388,7 +391,7 @@ int tts_parser_load_config(tts_config_s** config_info)
 
        cur = xmlDocGetRootElement(doc);
        if (cur == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document(%p)", doc);
                xmlFreeDoc(doc);
                doc = NULL;
                xmlCleanupParser();
@@ -396,7 +399,7 @@ int tts_parser_load_config(tts_config_s** config_info)
        }
 
        if (xmlStrcmp(cur->name, (const xmlChar *) TTS_TAG_CONFIG_BASE_TAG)) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s. doc(%p)", TTS_TAG_CONFIG_BASE_TAG, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                xmlCleanupParser();
@@ -405,7 +408,7 @@ int tts_parser_load_config(tts_config_s** config_info)
 
        cur = cur->xmlChildrenNode;
        if (cur == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document(%p)", doc);
                xmlFreeDoc(doc);
                doc = NULL;
                xmlCleanupParser();
@@ -416,7 +419,7 @@ int tts_parser_load_config(tts_config_s** config_info)
        tts_config_s* temp;
        temp = (tts_config_s*)calloc(1, sizeof(tts_config_s));
        if (NULL == temp) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Out of memory(%p)", doc);
                xmlFreeDoc(doc);
                doc = NULL;
                xmlCleanupParser();
@@ -557,10 +560,12 @@ int tts_parser_load_config(tts_config_s** config_info)
 int tts_parser_unload_config(tts_config_s* config_info)
 {
        if (NULL != g_config_doc) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Free g_config_doc(%p)", g_config_doc);
                xmlFreeDoc(g_config_doc);
                g_config_doc = NULL;
        }
        if (NULL != config_info) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Free config_info(%p)", config_info);
                free(config_info);
                config_info = NULL;
        }
@@ -614,8 +619,12 @@ int tts_parser_copy_xml(const char* original, const char* destination)
                SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Fail to change file mode : %d", ret);
        }
 
-       xmlFreeDoc(doc);
-       doc = NULL;
+       if (NULL != doc) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] doc(%p)", doc);
+               xmlFreeDoc(doc);
+               doc = NULL;
+       }
+
        SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[SUCCESS] Copying xml");
 
        return 0;
@@ -978,7 +987,7 @@ int tts_parser_find_config_changed(char** engine, char**setting, bool* auto_voic
        cur_new = xmlDocGetRootElement(doc);
        cur_old = xmlDocGetRootElement(g_config_doc);
        if (cur_new == NULL || cur_old == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document(%p)", doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -986,7 +995,7 @@ int tts_parser_find_config_changed(char** engine, char**setting, bool* auto_voic
 
        if (xmlStrcmp(cur_new->name, (const xmlChar*)TTS_TAG_CONFIG_BASE_TAG) || 
        xmlStrcmp(cur_old->name, (const xmlChar*)TTS_TAG_CONFIG_BASE_TAG)) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s", TTS_TAG_CONFIG_BASE_TAG);
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] The wrong type, root node is NOT %s. doc(%p)", TTS_TAG_CONFIG_BASE_TAG, doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -995,7 +1004,7 @@ int tts_parser_find_config_changed(char** engine, char**setting, bool* auto_voic
        cur_new = cur_new->xmlChildrenNode;
        cur_old = cur_old->xmlChildrenNode;
        if (cur_new == NULL || cur_old == NULL) {
-               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document");
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] Empty document(%p)", doc);
                xmlFreeDoc(doc);
                doc = NULL;
                return -1;
@@ -1175,6 +1184,7 @@ int tts_parser_find_config_changed(char** engine, char**setting, bool* auto_voic
        }
 
        if (NULL != g_config_doc) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Free g_config_doc(%p)", g_config_doc);
                xmlFreeDoc(g_config_doc);
                g_config_doc = NULL;
        }
@@ -1188,6 +1198,7 @@ int tts_parser_reset()
        SLOG(LOG_DEBUG, TAG_TTSCONFIG, "[DEBUG] Reset g_config_doc as %s", TTS_DEFAULT_CONFIG);
 
        if (NULL != g_config_doc) {
+               SLOG(LOG_ERROR, TAG_TTSCONFIG, "[DEBUG] Free g_config_doc(%p)", g_config_doc);
                xmlFreeDoc(g_config_doc);
                g_config_doc = NULL;
        }