[PATCH] Xext: Fix memory leaks in hashtable.

msrb at suse.com msrb at suse.com
Tue Aug 1 08:29:03 UTC 2017


From: Michal Srb <msrb at suse.com>

Do not forget to delete key and value of every item and the hashtable itself.
---
 Xext/hashtable.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Xext/hashtable.c b/Xext/hashtable.c
index 41b2e0013..93d1a2aec 100644
--- a/Xext/hashtable.c
+++ b/Xext/hashtable.c
@@ -77,10 +77,13 @@ ht_destroy(HashTable ht)
     for (c = 0; c < numBuckets; ++c) {
         xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) {
             xorg_list_del(&it->l);
+            free(it->key);
+            free(it->data);
             free(it);
         }
     }
     free(ht->buckets);
+    free(ht);
 }
 
 static Bool
-- 
2.12.3



More information about the xorg-devel mailing list