From: dyamy-lee Date: Mon, 11 Mar 2024 07:27:48 +0000 (+0900) Subject: change the order of setting root element about xmlDoc X-Git-Tag: accepted/tizen/unified/20240315.111155~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c793dad4b8ee41aad2472004c50e4dbbb88e559;p=platform%2Fcore%2Fuifw%2Fvoice-control.git change the order of setting root element about xmlDoc When calling 'xmlDocSetRootElement', it removes 'root' in this inside logic. So, the 'root' which allocated from 'xmlNewNode' has possiblity of free in it. Therefore, this patch changed the order of calling this function after calling 'xmlDocSetRootElement'. Change-Id: I64c3dc5154bef464586c4a81df99961965259cbf --- diff --git a/engine-parser/src/vc-engine-parser.c b/engine-parser/src/vc-engine-parser.c index 44d0f8e..9ccc88d 100644 --- a/engine-parser/src/vc-engine-parser.c +++ b/engine-parser/src/vc-engine-parser.c @@ -353,6 +353,8 @@ static int __write_metadata_inxml(const char *pkgid, const char *appid, GList *l xmlNodePtr root = NULL; xmlNodePtr cur = NULL; + xmlDocSetRootElement(g_doc, root); + root = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_BASE); if (NULL == root) { @@ -360,7 +362,6 @@ static int __write_metadata_inxml(const char *pkgid, const char *appid, GList *l // xmlFreeDoc(g_doc); return -1; } - xmlDocSetRootElement(g_doc, root); iter = g_list_first(list); while (NULL != iter) {