Merge pull request #4022 from Bond-009/arraypool
Fix incorrect usage of ArrayPool
This commit is contained in:
commit
43a81366a6
|
@ -130,6 +130,8 @@ namespace Jellyfin.Api.Helpers
|
|||
private async Task<int> CopyToInternalAsync(Stream source, Stream destination, bool readAsync, CancellationToken cancellationToken)
|
||||
{
|
||||
var array = ArrayPool<byte>.Shared.Rent(IODefaults.CopyToBufferSize);
|
||||
try
|
||||
{
|
||||
int bytesRead;
|
||||
int totalBytesRead = 0;
|
||||
|
||||
|
@ -171,5 +173,10 @@ namespace Jellyfin.Api.Helpers
|
|||
|
||||
return totalBytesRead;
|
||||
}
|
||||
finally
|
||||
{
|
||||
ArrayPool<byte>.Shared.Return(array);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user