Module: Mesa
Branch: staging/23.3
Commit: 06ab666613fa59781d01e1180196748c99537437
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=06ab666613fa59781d01e1180196748c99537437

Author: Boris Brezillon <boris.brezil...@collabora.com>
Date:   Fri Dec  1 18:39:31 2023 +0100

util/hash_table: Use FREE() to be consistent with the CALLOC_STRUCT() call

CALLOC_STRUCT() calls the OS abstraction layer to do the allocation.
Call FREE() to free the corresponding objects so we keep things
consistent and have proper debug traces when memory-debugging
is enabled.

Fixes: 6649b840c340 ("mesa/util: add a hash table wrapper which support 64-bit 
keys")
Signed-off-by: Boris Brezillon <boris.brezil...@collabora.com>
Reviewed-by: Yonggang Luo <luoyongg...@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26423>
(cherry picked from commit 977cc3157dc0215c065bc3039f7fd5c8b359dc17)

---

 .pick_status.json     | 2 +-
 src/util/hash_table.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 1f4a1332b67..48c11dd0156 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -34,7 +34,7 @@
         "description": "util/hash_table: Use FREE() to be consistent with the 
CALLOC_STRUCT() call",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "6649b840c34016b4753e69d4513a8d09da9febb2",
         "notes": null
diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index dc00b2de8e9..a832d589309 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -802,7 +802,7 @@ _mesa_hash_table_u64_delete_key(struct hash_entry *entry)
    struct hash_key_u64 *_key = (struct hash_key_u64 *)entry->key;
 
    if (_key)
-      free(_key);
+      FREE(_key);
 }
 
 void
@@ -905,6 +905,6 @@ _mesa_hash_table_u64_remove(struct hash_table_u64 *ht, 
uint64_t key)
       struct hash_key *_key = (struct hash_key *)entry->key;
 
       _mesa_hash_table_remove(ht->table, entry);
-      free(_key);
+      FREE(_key);
    }
 }

Reply via email to