Fix missing GetObjectNInfo Closure (#11243)

Review for missing Close of returned value from `GetObjectNInfo`.

This was often obscured by the stuff that auto-unlocks when reaching EOF.
This commit is contained in:
Klaus Post
2021-01-08 10:12:26 -08:00
committed by GitHub
parent 4593b146be
commit 51dad1d130
4 changed files with 13 additions and 10 deletions

View File

@@ -471,6 +471,8 @@ func replicateObject(ctx context.Context, objInfo ObjectInfo, objectAPI ObjectLa
for k, v := range putOpts.Header() {
headerSize += len(k) + len(v)
}
// r takes over closing gr.
r := bandwidth.NewMonitoredReader(ctx, globalBucketMonitor, objInfo.Bucket, objInfo.Name, gr, headerSize, b, target.BandwidthLimit)
_, err = tgt.PutObject(ctx, dest.Bucket, object, r, size, "", "", putOpts)
if err != nil {