fix: memory leakage (#3285)

This commit is contained in:
cfanbo 2022-04-22 23:52:48 +08:00 committed by GitHub
parent 74310b3de3
commit a26a83c247
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -111,11 +111,11 @@ func Authenticate(ctx context.Context, client *http.Client, url *url.URL, option
if err != nil {
return nil, err
}
defer res.Body.Close()
bodyBytes, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
defer res.Body.Close()
url, err = url.Parse(string(bodyBytes))
if err != nil {
return nil, err