backup-operator: close s3 reader after saving snapshot
After uploading the snapshot, the backup operator performs a get
to ensure that the snapshot was actually saved. The problem is that
the resulting get request body is not closed. This causes a leak
of http connections.
fixes
@@ -59,6 +59,9 @@ func (s3w *s3Writer) Write(ctx context.Context, path string, r io.Reader) (int64
if err != nil {
return 0, err
}
+ if resp.Body != nil {
+ defer resp.Body.Close()
+ }
if resp.ContentLength == nil {
return 0, fmt.Errorf("failed to compute s3 object size")
}
