archiver: reuse buffer if reading from file failed

This commit is contained in:
Michael Eischer
2026-05-16 12:05:39 +02:00
parent 3148494a92
commit ef750c4c5d
+2
View File
@@ -175,6 +175,7 @@ func (s *fileSaver) saveFile(ctx context.Context, chnker *chunker.Chunker, snPat
break
}
if err != nil {
buf.Release()
_ = f.Close()
completeError(err)
return
@@ -185,6 +186,7 @@ func (s *fileSaver) saveFile(ctx context.Context, chnker *chunker.Chunker, snPat
// test if the context has been cancelled, return the error
if ctx.Err() != nil {
buf.Release()
_ = f.Close()
completeError(ctx.Err())
return