Close backend files in case of errors

This commit is contained in:
Alexander Neumann
2018-01-25 21:05:57 +01:00
parent d62a664bb7
commit 909d9273cc
3 changed files with 4 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
hrd := hashing.NewReader(beRd, sha256.New())
packLength, err := io.Copy(tempfile, hrd)
if err != nil {
_ = beRd.Close()
return nil, errors.Wrap(err, "Copy")
}