diff options
author | Thomas Graf <tgraf@suug.ch> | 2012-11-10 10:52:26 +0100 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2012-11-10 10:52:26 +0100 |
commit | 59a6b003a95cdceb60e17c8cf765efc0d7bec797 (patch) | |
tree | c1c4376797d9f1331837949afb68c577316f8dbb | |
parent | ae1e236809d79f932b38a154ba1c2fce75f03701 (diff) | |
download | libnl-59a6b003a95cdceb60e17c8cf765efc0d7bec797.tar.gz |
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>
-rw-r--r-- | lib/hashtable.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); } } |