Mesa (main): util/disk_cache: Don't leak when cache is empty

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 2 03:17:06 UTC 2021


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

Author: Daniel Stone <daniels at collabora.com>
Date:   Thu Jul  1 23:58:49 2021 +0100

util/disk_cache: Don't leak when cache is empty

When we exit early having failed to find any candidate cache files to
evict, don't leak the list head whilst doing so.

Signed-off-by: Daniel Stone <daniels at collabora.com>
Fixes: f58e6fee7452 ("util/disk_cache: delete more cache items in one go when full")
Ref: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11523>

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11682>

---

 src/util/disk_cache_os.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/util/disk_cache_os.c b/src/util/disk_cache_os.c
index 1ab370fdec3..e93e8c65f3a 100644
--- a/src/util/disk_cache_os.c
+++ b/src/util/disk_cache_os.c
@@ -242,6 +242,7 @@ choose_lru_file_matching(const char *dir_path,
 
    if (list_is_empty(lru_file_list)) {
       closedir(dir);
+      free(lru_file_list);
       return NULL;
    }
 



More information about the mesa-commit mailing list