diff options
| -rw-r--r-- | src/bplist.c | 7 | ||||
| -rw-r--r-- | src/plist.c | 3 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/bplist.c b/src/bplist.c index d848e6a..95070d7 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -285,6 +285,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec | |||
| 285 | if (plist_get_node_type(size_node) != PLIST_UINT) | 285 | if (plist_get_node_type(size_node) != PLIST_UINT) |
| 286 | return NULL; | 286 | return NULL; |
| 287 | plist_get_uint_val(size_node, &size); | 287 | plist_get_uint_val(size_node, &size); |
| 288 | plist_free(size_node); | ||
| 288 | } | 289 | } |
| 289 | return parse_data_node(object, size); | 290 | return parse_data_node(object, size); |
| 290 | 291 | ||
| @@ -294,6 +295,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec | |||
| 294 | if (plist_get_node_type(size_node) != PLIST_UINT) | 295 | if (plist_get_node_type(size_node) != PLIST_UINT) |
| 295 | return NULL; | 296 | return NULL; |
| 296 | plist_get_uint_val(size_node, &size); | 297 | plist_get_uint_val(size_node, &size); |
| 298 | plist_free(size_node); | ||
| 297 | } | 299 | } |
| 298 | return parse_string_node(object, size); | 300 | return parse_string_node(object, size); |
| 299 | 301 | ||
| @@ -303,6 +305,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec | |||
| 303 | if (plist_get_node_type(size_node) != PLIST_UINT) | 305 | if (plist_get_node_type(size_node) != PLIST_UINT) |
| 304 | return NULL; | 306 | return NULL; |
| 305 | plist_get_uint_val(size_node, &size); | 307 | plist_get_uint_val(size_node, &size); |
| 308 | plist_free(size_node); | ||
| 306 | } | 309 | } |
| 307 | return parse_unicode_node(object, size); | 310 | return parse_unicode_node(object, size); |
| 308 | 311 | ||
| @@ -313,6 +316,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec | |||
| 313 | if (plist_get_node_type(size_node) != PLIST_UINT) | 316 | if (plist_get_node_type(size_node) != PLIST_UINT) |
| 314 | return NULL; | 317 | return NULL; |
| 315 | plist_get_uint_val(size_node, &size); | 318 | plist_get_uint_val(size_node, &size); |
| 319 | plist_free(size_node); | ||
| 316 | } | 320 | } |
| 317 | return parse_array_node(object, size, dict_size); | 321 | return parse_array_node(object, size, dict_size); |
| 318 | 322 | ||
| @@ -323,6 +327,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec | |||
| 323 | if (plist_get_node_type(size_node) != PLIST_UINT) | 327 | if (plist_get_node_type(size_node) != PLIST_UINT) |
| 324 | return NULL; | 328 | return NULL; |
| 325 | plist_get_uint_val(size_node, &size); | 329 | plist_get_uint_val(size_node, &size); |
| 330 | plist_free(size_node); | ||
| 326 | } | 331 | } |
| 327 | return parse_dict_node(object, size, dict_size); | 332 | return parse_dict_node(object, size, dict_size); |
| 328 | default: | 333 | default: |
| @@ -868,6 +873,8 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) | |||
| 868 | 873 | ||
| 869 | //free intermediate objects | 874 | //free intermediate objects |
| 870 | g_hash_table_foreach_remove(ref_table, free_index, NULL); | 875 | g_hash_table_foreach_remove(ref_table, free_index, NULL); |
| 876 | g_ptr_array_free(objects, TRUE); | ||
| 877 | g_hash_table_destroy(ref_table); | ||
| 871 | 878 | ||
| 872 | //write offsets | 879 | //write offsets |
| 873 | offset_size = get_needed_bytes(bplist_buff->len); | 880 | offset_size = get_needed_bytes(bplist_buff->len); |
diff --git a/src/plist.c b/src/plist.c index c69f4c1..0e73c4b 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -65,6 +65,7 @@ static void plist_free_node(GNode * node, gpointer none) | |||
| 65 | free(data); | 65 | free(data); |
| 66 | } | 66 | } |
| 67 | node->data = NULL; | 67 | node->data = NULL; |
| 68 | g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL); | ||
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | plist_t plist_new_dict() | 71 | plist_t plist_new_dict() |
| @@ -144,7 +145,7 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void * | |||
| 144 | 145 | ||
| 145 | void plist_free(plist_t plist) | 146 | void plist_free(plist_t plist) |
| 146 | { | 147 | { |
| 147 | g_node_children_foreach(plist, G_TRAVERSE_ALL, plist_free_node, NULL); | 148 | plist_free_node(plist, NULL); |
| 148 | g_node_destroy(plist); | 149 | g_node_destroy(plist); |
| 149 | } | 150 | } |
| 150 | 151 | ||
