mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Closed readCloser for each multipart in xl.GetObject (#1629)
* Closed readCloser for each multipart in xl.GetObject
This commit is contained in:
parent
ee8605e333
commit
9e45d138cc
@ -189,10 +189,19 @@ func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.Read
|
||||
}
|
||||
// Reset offset to 0 as it would be non-0 only for the first loop if startOffset is non-0.
|
||||
offset = 0
|
||||
if _, err := io.Copy(fileWriter, r); err != nil {
|
||||
if _, err = io.Copy(fileWriter, r); err != nil {
|
||||
switch reader := r.(type) {
|
||||
case *io.PipeReader:
|
||||
reader.CloseWithError(err)
|
||||
case io.ReadCloser:
|
||||
reader.Close()
|
||||
}
|
||||
fileWriter.CloseWithError(err)
|
||||
return
|
||||
}
|
||||
// Close the readerCloser that reads multiparts of an object from the xl storage layer.
|
||||
// Not closing leaks underlying file descriptors.
|
||||
r.Close()
|
||||
}
|
||||
fileWriter.Close()
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user