From 16f45a04f8790f36e5af939bfd728ee410470e05 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 29 Jun 2016 13:17:00 +0200 Subject: xplist: Plug memory leak when converting PLIST_UID nodes to XML In node_to_xml nodes of type PLIST_UID are temporarily converted to a PLIST_DICT for an appropriate XML output. Therefore a PLIST_KEY and a PLIST_UINT node is created and inserted into the PLIST_DICT node. Upon completion, the child nodes of the PLIST_DICT node are detached from the original node and freed, however the data of the child nodes - the key string and the uint value - are not. This commit fixes it. --- src/xplist.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/xplist.c') diff --git a/src/xplist.c b/src/xplist.c index e0a76da..8fe3604 100644 --- a/src/xplist.c +++ b/src/xplist.c @@ -337,6 +337,7 @@ static void node_to_xml(node_t* node, void *xml_struct) for (j = num; j > 0; j--) { node_t* ch = node_nth_child(node, j-1); node_detach(node, ch); + plist_free_data((plist_data_t)((node_t*)ch)->data); node_destroy(ch); } node_data->type = PLIST_UID; -- cgit v1.1-32-gdbae