util/hash_table: do not leak u64 struct key

For non 64bit devices the key stored in hash_table_u64 is wrapped in
hash_key_u64 structure, which is never free.

This commit fixes this issue by just removing the user-defined
`delete_function` parameter in hash_table_u64_{destroy,clear} (which
nobody is using) and using instead a delete function to free this
structure.

Fixes: 608257cf82 ("i965: Fix INTEL_DEBUG=bat")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10480>
This commit is contained in:
Juan A. Suarez Romero
2021-04-27 12:08:50 +02:00
parent 33f9b06b0e
commit e532a47f76
13 changed files with 36 additions and 68 deletions

View File

@@ -378,8 +378,8 @@ _mesa_init_resident_handles(struct gl_context *ctx)
void
_mesa_free_resident_handles(struct gl_context *ctx)
{
_mesa_hash_table_u64_destroy(ctx->ResidentTextureHandles, NULL);
_mesa_hash_table_u64_destroy(ctx->ResidentImageHandles, NULL);
_mesa_hash_table_u64_destroy(ctx->ResidentTextureHandles);
_mesa_hash_table_u64_destroy(ctx->ResidentImageHandles);
}
/**
@@ -397,10 +397,10 @@ void
_mesa_free_shared_handles(struct gl_shared_state *shared)
{
if (shared->TextureHandles)
_mesa_hash_table_u64_destroy(shared->TextureHandles, NULL);
_mesa_hash_table_u64_destroy(shared->TextureHandles);
if (shared->ImageHandles)
_mesa_hash_table_u64_destroy(shared->ImageHandles, NULL);
_mesa_hash_table_u64_destroy(shared->ImageHandles);
mtx_destroy(&shared->HandlesMutex);
}