diff --git a/br/pkg/conn/conn.go b/br/pkg/conn/conn.go index 14292ae091739..16c86e18c8985 100644 --- a/br/pkg/conn/conn.go +++ b/br/pkg/conn/conn.go @@ -381,11 +381,11 @@ func (mgr *Mgr) GetConfigFromTiKV(ctx context.Context, cli *http.Client, fn func if e != nil { return e } + defer resp.Body.Close() err = fn(resp) if err != nil { return err } - _ = resp.Body.Close() return nil }, utils.NewPDReqBackoffer()) if err != nil {