Skip to content

Commit

Permalink
Merge pull request #9 from avl/master
Browse files Browse the repository at this point in the history
Do not Return outputBuffer more than once
  • Loading branch information
oleg-st authored Sep 1, 2022
2 parents 912534b + 783f46e commit e784405
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ZstdSharp/CompressionStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ private void ReleaseUnmanagedResources()
if (!preserveCompressor)
{
compressor.Dispose();
compressor = null;
}

compressor = null;

ArrayPool<byte>.Shared.Return(outputBuffer);
}

Expand Down
3 changes: 2 additions & 1 deletion src/ZstdSharp/DecompressionStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ protected override void Dispose(bool disposing)
if (!preserveDecompressor)
{
decompressor.Dispose();
decompressor = null;
}

decompressor = null;

ArrayPool<byte>.Shared.Return(inputBuffer);
}
Expand Down

0 comments on commit e784405

Please sign in to comment.