diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/bplist.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bplist.c b/src/bplist.c index 40b453b..cbe9481 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -720,8 +720,6 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * | |||
| 720 | node_attach(nodeslist[i], n); | 720 | node_attach(nodeslist[i], n); |
| 721 | } | 721 | } |
| 722 | } | 722 | } |
| 723 | |||
| 724 | free(data->buff); | ||
| 725 | break; | 723 | break; |
| 726 | 724 | ||
| 727 | case PLIST_ARRAY: | 725 | case PLIST_ARRAY: |
| @@ -738,7 +736,6 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * | |||
| 738 | node_attach(nodeslist[i], node_copy_deep(nodeslist[index1], copy_plist_data)); | 736 | node_attach(nodeslist[i], node_copy_deep(nodeslist[index1], copy_plist_data)); |
| 739 | } | 737 | } |
| 740 | } | 738 | } |
| 741 | free(data->buff); | ||
| 742 | break; | 739 | break; |
| 743 | default: | 740 | default: |
| 744 | break; | 741 | break; |
| @@ -749,6 +746,11 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * | |||
| 749 | 746 | ||
| 750 | // free unreferenced nodes that would otherwise leak memory | 747 | // free unreferenced nodes that would otherwise leak memory |
| 751 | for (i = 0; i < num_objects; i++) { | 748 | for (i = 0; i < num_objects; i++) { |
| 749 | plist_data_t data = plist_get_data(nodeslist[i]); | ||
| 750 | if ((data->type == PLIST_DICT) || (data->type == PLIST_ARRAY)) { | ||
| 751 | free(data->buff); | ||
| 752 | data->buff = NULL; | ||
| 753 | } | ||
| 752 | if (i == root_object) continue; | 754 | if (i == root_object) continue; |
| 753 | node_t* node = (node_t*)nodeslist[i]; | 755 | node_t* node = (node_t*)nodeslist[i]; |
| 754 | if (node && NODE_IS_ROOT(node)) { | 756 | if (node && NODE_IS_ROOT(node)) { |
