revert xmlDocSetRootElement() location 57/307857/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 12 Mar 2024 11:20:29 +0000 (20:20 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Thu, 14 Mar 2024 01:55:24 +0000 (10:55 +0900)
Inside xmlDocSetRootElement(), it checked root is null.
If root is null, it doesn't connect it's memory. So, it needs not null of root.
Then, this patch rollback to previous logic.

Change-Id: Ia291aec3a55b5d53e211de6d181df31e02cc8855

engine-parser/src/vc-engine-parser.c

index 9ccc88d8327b0bd3e3742fb07affb4620d35af06..44d0f8e2be9a7ec900dc01707732a8a64482041a 100644 (file)
@@ -353,8 +353,6 @@ 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) {
@@ -362,6 +360,7 @@ 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) {