diff options
Diffstat (limited to 'src/bplist.c')
| -rw-r--r-- | src/bplist.c | 9 |
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 | ||
