From d40f8a2fcb87c26dd6179f3315fc49e2cda53282 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 1 Jul 2021 23:58:49 +0100 Subject: [PATCH] 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 Fixes: f58e6fee7452 ("util/disk_cache: delete more cache items in one go when full") Ref: Reviewed-By: Mike Blumenkrantz Reviewed-by: Timothy Arceri Part-of: --- 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; }