mirror of
https://github.com/restic/restic.git
synced 2026-09-20 11:08:30 +00:00
backend/sftp: fix file handle leak if chmod for a file fails
This commit is contained in:
@@ -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