diff options
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/ImageUtil.java | 4 |
1 files changed, 3 insertions, 1 deletions
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); } |