2
0
mirror of https://github.com/42wim/matterbridge synced 2024-11-03 15:40:24 +00:00

Do not close body on err. Closes #364

This commit is contained in:
Wim 2018-02-07 00:04:02 +01:00
parent 432cd0f99d
commit 3480c88e90

View File

@ -20,9 +20,9 @@ func DownloadFile(url string) (*[]byte, error) {
}
resp, err := client.Do(req)
if err != nil {
resp.Body.Close()
return nil, err
}
defer resp.Body.Close()
io.Copy(&buf, resp.Body)
data := buf.Bytes()
resp.Body.Close()