From 1e1fe4a37576999507cc6d2235ad78f76497ea85 Mon Sep 17 00:00:00 2001 From: Adrian Ulrich Date: Thu, 17 Nov 2016 17:57:17 +0100 Subject: [PATCH] fix fd-leak --- src/ch/blinkenlights/android/vanilla/CoverCache.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ch/blinkenlights/android/vanilla/CoverCache.java b/src/ch/blinkenlights/android/vanilla/CoverCache.java index 9eb732eb..55e136d5 100644 --- a/src/ch/blinkenlights/android/vanilla/CoverCache.java +++ b/src/ch/blinkenlights/android/vanilla/CoverCache.java @@ -458,11 +458,13 @@ public class CoverCache { bopts.inJustDecodeBounds = true; final int inSampleSize = getSampleSize(sampleInputStream, bopts, maxPxCount); - /* reuse bopts: we are now REALLY going to decode the image */ bopts.inJustDecodeBounds = false; bopts.inSampleSize = inSampleSize; - return BitmapFactory.decodeStream(inputStream, null, bopts); + Bitmap bitmap = BitmapFactory.decodeStream(inputStream, null, bopts); + sampleInputStream.close(); + inputStream.close(); + return bitmap; } } catch (Exception e) { // no cover art found