From 7d4895fa96b7b6fade76b995d8a4d572768cd2f7 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Tue, 7 Dec 2021 13:27:55 +0800 Subject: [PATCH] infosync: close body when ReadAll encounters error (#30462) --- 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 {