Commit 9bccdb30 authored by Jonathan Beck's avatar Jonathan Beck

Copy xml buffer to malloced buffer to prevent free / xmlFree mixing.

parent 210ead70
......@@ -373,9 +373,16 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
node_to_xml(plist, &root);
xmlDocDumpMemory(plist_doc, (xmlChar **) plist_xml, &size);
if (size >= 0)
xmlChar* tmp = NULL;
xmlDocDumpMemory(plist_doc, &tmp, &size);
if (size >= 0 && tmp)
{
*plist_xml = (char*)malloc(size * sizeof(char));
memcpy(*plist_xml, tmp, size);
*length = size;
xmlFree(tmp);
tmp = NULL;
}
xmlFreeDoc(plist_doc);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment