[Mesa-dev] [PATCH 2/5] util/hash_table: don't compare deleted entries

Connor Abbott cwabbott0 at gmail.com
Sat Nov 14 18:59:41 PST 2015


The equivalent of the last patch for the hash table. I'm not aware of
any issues this fixes.

Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
 src/util/hash_table.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 3247593..466519f 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -300,7 +300,8 @@ hash_table_insert(struct hash_table *ht, uint32_t hash,
        * required to avoid memory leaks, perform a search
        * before inserting.
        */
-      if (entry->hash == hash &&
+      if (entry_is_present(ht, entry) &&
+          entry->hash == hash &&
           ht->key_equals_function(key, entry->key)) {
          entry->key = key;
          entry->data = data;
-- 
2.4.3



More information about the mesa-dev mailing list