Skip to content
Snippets Groups Projects
Commit 59a6b003 authored by Thomas Graf's avatar Thomas Graf
Browse files

hashtable: Fix reference leak in nl_hashtable_free()


The reference counter of the linked object must be dec'ed
before freeing the node or the reference is leaked.

Signed-off-by: default avatarThomas Graf <tgraf@suug.ch>
parent ae1e2368
Branches
No related merge requests found
......@@ -57,6 +57,8 @@ errout:
/**
* Free hashtable including all nodes
* @arg ht Hashtable
*
* @note Reference counter of all objects in the hashtable will be decremented.
*/
void nl_hash_table_free(nl_hash_table_t *ht)
{
......@@ -69,6 +71,7 @@ void nl_hash_table_free(nl_hash_table_t *ht)
while (node) {
saved_node = node;
node = node->next;
nl_object_put(saved_node->obj);
free(saved_node);
}
}
......
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