"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
accounting: fix memory leak on retries operations
Nick Craig-Woodd46f8d0ae540
diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.goindex 1c838a55b..dd9a5145f 100644--- a/fs/accounting/accounting.go+++ b/fs/accounting/accounting.go@@ -70,6 +70,10 @@ func newAccountSizeName(stats *StatsInfo, in io.ReadCloser, size int64, name str// WithBuffer - If the file is above a certain size it adds an Async readerfunc (acc *Account) WithBuffer() *Account {+ // if already have a buffer then just return+ if acc.withBuf {+ return acc+ }acc.withBuf = truevar buffers intif acc.size >= int64(fs.Config.BufferSize) || acc.size == -1 {@@ -118,14 +122,16 @@ func (acc *Account) StopBuffering() {// async buffer (if any) and re-adding itfunc (acc *Account) UpdateReader(in io.ReadCloser) {acc.mu.Lock()- if acc.withBuf {+ withBuf := acc.withBuf+ if withBuf {acc.StopBuffering()+ acc.withBuf = false}acc.in = inacc.close = inacc.origIn = inacc.closed = false- if acc.withBuf {+ if withBuf {acc.WithBuffer()}acc.mu.Unlock()