From 8cea78de83744ea955d4cfb7dcad3ca8abf43223 Mon Sep 17 00:00:00 2001 From: Two-Ai <81279822+Two-Ai@users.noreply.github.com> Date: Fri, 13 Jan 2023 22:30:26 -0500 Subject: [PATCH] Fix ChapterCache.isImageInCache() resource leak (#8907) diskCache.get() returns a DiskLruCache.Snapshot which must be closed. --- .../main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt index 361f710b84..9842a8ff08 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/cache/ChapterCache.kt @@ -128,7 +128,7 @@ class ChapterCache(private val context: Context) { */ fun isImageInCache(imageUrl: String): Boolean { return try { - diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)) != null + diskCache.get(DiskUtil.hashKeyForDisk(imageUrl)).use { it != null } } catch (e: IOException) { false }