Merge pull request #4022 from Bond-009/arraypool

Fix incorrect usage of ArrayPool
pull/3736/head
Anthony Lavado 4 years ago committed by GitHub
commit 43a81366a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save