summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/xplist.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 8b6a632..f9289b0 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -373,9 +373,16 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length)
373 373
374 node_to_xml(plist, &root); 374 node_to_xml(plist, &root);
375 375
376 xmlDocDumpMemory(plist_doc, (xmlChar **) plist_xml, &size); 376 xmlChar* tmp = NULL;
377 if (size >= 0) 377 xmlDocDumpMemory(plist_doc, &tmp, &size);
378 if (size >= 0 && tmp)
379 {
380 *plist_xml = (char*)malloc(size * sizeof(char));
381 memcpy(*plist_xml, tmp, size);
378 *length = size; 382 *length = size;
383 xmlFree(tmp);
384 tmp = NULL;
385 }
379 xmlFreeDoc(plist_doc); 386 xmlFreeDoc(plist_doc);
380} 387}
381 388