fix: getObject fd leaks in transition and replication code (#11237)

This commit is contained in:
Harshavardhana
2021-01-06 16:13:10 -08:00
committed by GitHub
parent a6dee21092
commit f0808bb2e5
3 changed files with 43 additions and 31 deletions

View File

@@ -340,13 +340,14 @@ func transitionObject(ctx context.Context, objectAPI ObjectLayer, objInfo Object
return err
}
oi := gr.ObjInfo
if oi.TransitionStatus == lifecycle.TransitionComplete {
gr.Close() // make sure to avoid leaks.
return nil
}
putOpts := putTransitionOpts(oi)
if _, err = tgt.PutObject(ctx, arn.Bucket, oi.Name, gr, oi.Size, "", "", putOpts); err != nil {
gr.Close() // make sure to avoid leaks.
return err
}
gr.Close()