From afdc138dffe256761be83a2035172fd59cec724c Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 7 Dec 2021 11:20:45 +0800 Subject: [PATCH] close body when ReadAll encounters error close #30464 Signed-off-by: Ryan Leung --- domain/infosync/info.go | 1 + 1 file changed, 1 insertion(+) diff --git a/domain/infosync/info.go b/domain/infosync/info.go index 29b71e8b9f276..26bd49d57ed38 100644 --- a/domain/infosync/info.go +++ b/domain/infosync/info.go @@ -349,6 +349,7 @@ func doRequest(ctx context.Context, addrs []string, route, method string, body i if err == nil { bodyBytes, err := io.ReadAll(res.Body) if err != nil { + terror.Log(res.Body.Close()) return nil, err } if res.StatusCode != http.StatusOK {