mirror of
https://github.com/restic/restic.git
synced 2026-11-20 04:26:54 +00:00
backend/sftp: fix file handle leak if chmod for a file fails
This commit is contained in:
1 parent
ae8fdb08fa
commit
faea0d677a
1 file changed
+1
@@ -363,6 +363,7 @@ func (r *SFTP) Save(_ context.Context, h backend.Handle, rd backend.RewindReader
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
err = f.Chmod(r.Modes.File)
|
err = f.Chmod(r.Modes.File)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
_ = f.Close()
|
||||||
return errors.Wrapf(err, "Chmod %v", tmpFilename)
|
return errors.Wrapf(err, "Chmod %v", tmpFilename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user