mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 15:04:43 +00:00
Update src/SharpCompress/IO/PooledMemoryStream.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -892,11 +892,10 @@ public sealed class PooledMemoryStream : MemoryStream
|
||||
_contiguousBuffer = null;
|
||||
}
|
||||
|
||||
for (var i = 0; i < _detachedExposedBuffers.Count; i++)
|
||||
{
|
||||
_arrayPool.Return(_detachedExposedBuffers[i]);
|
||||
}
|
||||
|
||||
// Buffers tracked here have been exposed to callers. Returning them to the
|
||||
// shared pool would allow unrelated code to rent and mutate arrays that may
|
||||
// still be referenced after the stream is disposed, which breaks
|
||||
// MemoryStream-compatible expectations for GetBuffer/TryGetBuffer.
|
||||
_detachedExposedBuffers.Clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user