summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2014-05-18 02:39:13 +0200
committerGravatar Nikias Bassen2014-05-18 02:39:13 +0200
commit6a38f51266829feb975cdd8daed6656842e5ecd9 (patch)
tree1b0112f0b52efca31128310abdfc3bf2a76b3a43
parentdf053ccdbb1cec856aa3a99c836ec6111d727a78 (diff)
downloadlibplist-6a38f51266829feb975cdd8daed6656842e5ecd9.tar.gz
libplist-6a38f51266829feb975cdd8daed6656842e5ecd9.tar.bz2
bplist: Fix memory leaking caused by unused nodes in plist_from_bin()
-rw-r--r--src/bplist.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c
index 523d0fe..d1694b9 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -715,6 +715,15 @@ void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * plist)
715 } 715 }
716 716
717 *plist = nodeslist[root_object]; 717 *plist = nodeslist[root_object];
718
719 // free unreferenced nodes that would otherwise leak memory
720 for (i = 0; i < num_objects; i++) {
721 if (i == root_object) continue;
722 node_t* node = (node_t*)nodeslist[i];
723 if (NODE_IS_ROOT(node)) {
724 plist_free(node);
725 }
726 }
718 free(nodeslist); 727 free(nodeslist);
719} 728}
720 729