v3dv: don't leak cache key

The hashtable stores a hash generated from the key, so there is no need
to duplicate the key, as otherwise it is a leak.

Found through address sanitizer.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30204>
This commit is contained in:
Juan A. Suarez Romero
2024-07-16 09:24:19 +02:00
committed by Marge Bot
parent 6be7e25256
commit 433a0422d5

View File

@@ -2536,10 +2536,8 @@ get_copy_texel_buffer_pipeline(
goto fail;
if (device->instance->meta_cache_enabled) {
uint8_t *dupkey = malloc(V3DV_META_TEXEL_BUFFER_COPY_CACHE_KEY_SIZE);
memcpy(dupkey, key, V3DV_META_TEXEL_BUFFER_COPY_CACHE_KEY_SIZE);
_mesa_hash_table_insert(device->meta.texel_buffer_copy.cache[image_type],
dupkey, *pipeline);
key, *pipeline);
mtx_unlock(&device->meta.mtx);
} else {
v3dv_cmd_buffer_add_private_obj(