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@collabora.com>
Fixes: f58e6fee74 ("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@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11682>
This commit is contained in:
Daniel Stone 2021-07-01 23:58:49 +01:00 committed by Marge Bot
parent 19cf64aabd
commit d40f8a2fcb

View file

@ -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;
}