mirror of
https://github.com/restic/restic.git
synced 2026-11-22 15:08:51 +00:00
repository: Improve buffer pooling
This commit is contained in:
1 parent
4c00efd4bf
commit
a56b8fad87
2 files changed
+2
-2
No files matched your search
@@ -214,11 +214,11 @@ func (r *Repository) SaveAndEncrypt(ctx context.Context, t restic.BlobType, data
|
||||
|
||||
// get buf from the pool
|
||||
ciphertext := getBuf()
|
||||
defer freeBuf(ciphertext)
|
||||
|
||||
ciphertext = ciphertext[:0]
|
||||
nonce := crypto.NewRandomNonce()
|
||||
ciphertext = append(ciphertext, nonce...)
|
||||
defer freeBuf(ciphertext)
|
||||
|
||||
// encrypt blob
|
||||
ciphertext = r.key.Seal(ciphertext, nonce, data, nil)
|
||||
|
||||
Reference in new issue
Block a user