mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 09:44:47 +03:00
improve stream disposal
This commit is contained in:
@@ -457,9 +457,9 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||
{
|
||||
var ms = new MemoryStream();
|
||||
|
||||
using (var input = dataToSave)
|
||||
using (dataToSave)
|
||||
{
|
||||
await input.CopyToAsync(ms).ConfigureAwait(false);
|
||||
await dataToSave.CopyToAsync(ms).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
ms.Position = 0;
|
||||
@@ -470,9 +470,9 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||
{
|
||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous))
|
||||
{
|
||||
using (var input = dataToSave)
|
||||
using (dataToSave)
|
||||
{
|
||||
await input.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
await dataToSave.CopyToAsync(fs, StreamDefaults.DefaultCopyToBufferSize, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user