1
mirror of https://github.com/rclone/rclone synced 2024-12-10 22:33:56 +01:00

onedrive: Fix socket leak in multipart session upload

This had gone unnoticed until recently when we changed to uploading
all files with a multipart session.
This commit is contained in:
Nick Craig-Wood 2018-03-26 17:17:56 +01:00
parent 4d553ef701
commit 9df266a6b4

View File

@ -1125,12 +1125,14 @@ func (o *Object) uploadFragment(url string, start int64, totalSize int64, chunk
err = o.fs.pacer.Call(func() (bool, error) {
_, _ = chunk.Seek(0, 0)
resp, err = o.fs.srv.Call(&opts)
if resp != nil {
defer fs.CheckClose(resp.Body, &err)
}
retry, err := shouldRetry(resp, err)
if !retry && resp != nil {
if resp.StatusCode == 200 || resp.StatusCode == 201 {
// we are done :)
// read the item
defer fs.CheckClose(resp.Body, &err)
info = &api.Item{}
return false, json.NewDecoder(resp.Body).Decode(info)
}