Skip to content

Commit

Permalink
PR #458: Dispose of entry streams returned by ZipFile.GetInputStream
Browse files Browse the repository at this point in the history
  • Loading branch information
Numpsy authored Aug 7, 2020
1 parent 75adef5 commit f593921
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/ICSharpCode.SharpZipLib/Zip/FastZip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,14 +636,18 @@ private void ExtractFileEntry(ZipEntry entry, string targetName)
{
buffer_ = new byte[4096];
}
if ((events_ != null) && (events_.Progress != null))
{
StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_,
events_.Progress, events_.ProgressInterval, this, entry.Name, entry.Size);
}
else

using (var inputStream = zipFile_.GetInputStream(entry))
{
StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_);
if ((events_ != null) && (events_.Progress != null))
{
StreamUtils.Copy(inputStream, outputStream, buffer_,
events_.Progress, events_.ProgressInterval, this, entry.Name, entry.Size);
}
else
{
StreamUtils.Copy(inputStream, outputStream, buffer_);
}
}

if (events_ != null)
Expand Down

0 comments on commit f593921

Please sign in to comment.