dect
/
libnl
Archived
13
0
Fork 0

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: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
Thomas Graf 2012-11-10 10:52:26 +01:00
parent ae1e236809
commit 59a6b003a9
1 changed files with 3 additions and 0 deletions

View File

@ -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);
}
}