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
xmlNodePtr root = NULL;
xmlNodePtr cur = NULL;
+ xmlDocSetRootElement(g_doc, root);
+
root = xmlNewNode(NULL, (const xmlChar*)VC_TAG_ENGINE_BASE);
if (NULL == root) {
// xmlFreeDoc(g_doc);
return -1;
}
- xmlDocSetRootElement(g_doc, root);
iter = g_list_first(list);
while (NULL != iter) {