From 59a6b003a95cdceb60e17c8cf765efc0d7bec797 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Sat, 10 Nov 2012 10:52:26 +0100 Subject: 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 --- lib/hashtable.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/hashtable.c b/lib/hashtable.c index 5cea985..6a1e8f5 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -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); } } -- cgit v1.2.1