Skip to content

Commit

Permalink
Fix memory leak issue where private InputStream(s) were not closed. F…
Browse files Browse the repository at this point in the history
…ound by using StrictMode.
  • Loading branch information
NetEvolutions committed Sep 29, 2022
1 parent ab7dfc0 commit 1194f34
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,14 @@ public int available() throws IOException {
return (is != null) ? is.available() : 0;
}

@Override
public void close() throws IOException {
if (is != null) {
is.close();
}
super.close();
}

@Override
public int read() throws IOException {
InputStream is = getInputStream();
Expand Down Expand Up @@ -633,6 +641,14 @@ public LollipopLazyInputStream(PathHandler handler, Uri uri) {
this.uri = uri;
}

@Override
public void close() throws IOException {
if (is != null) {
is.close();
}
super.close();
}

@Override
protected InputStream handle() {
return handler.handle(uri);
Expand Down

0 comments on commit 1194f34

Please sign in to comment.