madmin: close http response when returning an error (#6526)

httpRespToErrorResponse() usually reads the http response when
the http error code is not expected to parse the json error
response in the http body, however it was never properly closing
the connection. This PR fixes the behavior.
This commit is contained in:
Anis Elleuch 2018-09-26 19:03:35 +01:00 committed by Harshavardhana
parent ce1bfa6de8
commit 20378821cf
2 changed files with 1 additions and 1 deletions

View file

@ -73,6 +73,7 @@ func httpRespToErrorResponse(resp *http.Response) error {
Message: "Failed to parse server response.",
}
}
closeResponse(resp)
return errResp
}

View file

@ -92,7 +92,6 @@ func (adm *AdminClient) DownloadProfilingData() (io.ReadCloser, error) {
}
if resp.StatusCode != http.StatusOK {
closeResponse(resp)
return nil, httpRespToErrorResponse(resp)
}