Commit 3c458d22 authored by Jonathan Beck's avatar Jonathan Beck

Fix more memory leaks.

parent aa3a4c8d
......@@ -285,6 +285,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec
if (plist_get_node_type(size_node) != PLIST_UINT)
return NULL;
plist_get_uint_val(size_node, &size);
plist_free(size_node);
}
return parse_data_node(object, size);
......@@ -294,6 +295,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec
if (plist_get_node_type(size_node) != PLIST_UINT)
return NULL;
plist_get_uint_val(size_node, &size);
plist_free(size_node);
}
return parse_string_node(object, size);
......@@ -303,6 +305,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec
if (plist_get_node_type(size_node) != PLIST_UINT)
return NULL;
plist_get_uint_val(size_node, &size);
plist_free(size_node);
}
return parse_unicode_node(object, size);
......@@ -313,6 +316,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec
if (plist_get_node_type(size_node) != PLIST_UINT)
return NULL;
plist_get_uint_val(size_node, &size);
plist_free(size_node);
}
return parse_array_node(object, size, dict_size);
......@@ -323,6 +327,7 @@ static plist_t parse_bin_node(char *object, uint8_t dict_size, char **next_objec
if (plist_get_node_type(size_node) != PLIST_UINT)
return NULL;
plist_get_uint_val(size_node, &size);
plist_free(size_node);
}
return parse_dict_node(object, size, dict_size);
default:
......@@ -868,6 +873,8 @@ void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
//free intermediate objects
g_hash_table_foreach_remove(ref_table, free_index, NULL);
g_ptr_array_free(objects, TRUE);
g_hash_table_destroy(ref_table);
//write offsets
offset_size = get_needed_bytes(bplist_buff->len);
......
......@@ -65,6 +65,7 @@ static void plist_free_node(GNode * node, gpointer none)
free(data);
}
node->data = NULL;
g_node_children_foreach(node, G_TRAVERSE_ALL, plist_free_node, NULL);
}
plist_t plist_new_dict()
......@@ -144,7 +145,7 @@ static plist_t plist_add_sub_element(plist_t node, plist_type type, const void *
void plist_free(plist_t plist)
{
g_node_children_foreach(plist, G_TRAVERSE_ALL, plist_free_node, NULL);
plist_free_node(plist, NULL);
g_node_destroy(plist);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment