From: Thomas Graf Date: Sat, 10 Nov 2012 09:52:26 +0000 (+0100) Subject: hashtable: Fix reference leak in nl_hashtable_free() X-Git-Tag: libnl3_2_15~32 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=59a6b003a95cdceb60e17c8cf765efc0d7bec797;p=thirdparty%2Flibnl.git 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 --- 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); } }