"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
smb: fix TCP connection leak when connection setup fails - fixes #9678
Nick Craig-Wood74f9f182aa0b
diff --git a/backend/smb/connpool.go b/backend/smb/connpool.goindex aa2b0a178..379866137 100644--- a/backend/smb/connpool.go+++ b/backend/smb/connpool.go@@ -21,12 +21,18 @@ import (// initiates the SMB handshake, and then sets up a Client.//// The context is only used for establishing the connection, not after.-func (f *Fs) dial(ctx context.Context, network, addr string) (*conn, error) {+func (f *Fs) dial(ctx context.Context, network, addr string) (c *conn, err error) {dialer := fshttp.NewDialer(ctx)tconn, err := dialer.DialContext(ctx, network, addr)if err != nil {return nil, err}+ // Close tconn it if any of the remaining setup fails.+ defer func() {+ if err != nil {+ _ = tconn.Close()+ }+ }()pass := ""if f.opt.Pass != "" {