Mesa (main): v3d: fix some leaks in cache

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 4 11:04:34 UTC 2022


Module: Mesa
Branch: main
Commit: 689f9d2a5bad216be56191a5141f3b5f78f37692
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=689f9d2a5bad216be56191a5141f3b5f78f37692

Author: Juan A. Suarez Romero <jasuarez at igalia.com>
Date:   Mon Apr  4 10:21:21 2022 +0200

v3d: fix some leaks in cache

Fix a couple of leaks introduced when adding support for on-disk shader
cache.

Fixes: 4468db20f7f ("v3d: add support for on-disk shader cache")
Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15733>

---

 src/gallium/drivers/v3d/v3d_disk_cache.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/drivers/v3d/v3d_disk_cache.c b/src/gallium/drivers/v3d/v3d_disk_cache.c
index a6a62666360..8ea50fc23da 100644
--- a/src/gallium/drivers/v3d/v3d_disk_cache.c
+++ b/src/gallium/drivers/v3d/v3d_disk_cache.c
@@ -71,6 +71,8 @@ void v3d_disk_cache_init(struct v3d_screen *screen)
         _mesa_sha1_format(timestamp, id_sha1);
 
         screen->disk_cache = disk_cache_create(renderer, timestamp, 0);
+
+        free(renderer);
 }
 
 static void
@@ -226,6 +228,8 @@ v3d_disk_cache_store(struct v3d_context *v3d,
         blob_write_bytes(&blob, qpu_insts, qpu_size);
 
         disk_cache_put(cache, cache_key, blob.data, blob.size, NULL);
+
+        blob_finish(&blob);
 }
 
 #endif /* ENABLE_SHADER_CACHE */



More information about the mesa-commit mailing list