From 010eb44ad971ad9e77b555179d70b6e43d1dec80 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Mon, 26 Feb 2018 20:52:16 +0100 Subject: fixes FS#257 - Fix policy 31 violation --- src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java index eee18cc9..a741dfbd 100644 --- a/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java +++ b/src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java @@ -350,12 +350,14 @@ public final class ImageUtil { public static int calcSampleSize(Uri image, int size) throws FileNotFoundException { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; - Bitmap bmp = BitmapFactory.decodeStream(StreamUtil.openInputStreamFromContentResolver(image), null, options); + InputStream bmpInputStream = StreamUtil.openInputStreamFromContentResolver(image); + Bitmap bmp = BitmapFactory.decodeStream(bmpInputStream, null, options); int height = options.outHeight; int width = options.outWidth; if (null != bmp) { bmp.recycle(); } + StreamUtil.close(bmpInputStream); return calcSampleSize(width, height, size); } -- cgit v1.2.3