Skip to content

Commit

Permalink
Merge pull request #1 from werktools/fix-inputstream-memory-leak-android
Browse files Browse the repository at this point in the history
Fix memory leak issue where private InputStream(s) were not closed. F…
  • Loading branch information
NetEvolutions committed Aug 28, 2023
2 parents ab7dfc0 + 1194f34 commit 940cce4
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 940cce4

Please sign in to comment.