From c6d55954e0c3f28184a092955300f03391378d8c Mon Sep 17 00:00:00 2001 From: Allen Sun Date: Thu, 21 Sep 2017 20:11:22 +0800 Subject: [PATCH] add a response body close Signed-off-by: Allen Sun --- remotes/docker/fetcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remotes/docker/fetcher.go b/remotes/docker/fetcher.go index e4a70ac85..c2ebd1a3b 100644 --- a/remotes/docker/fetcher.go +++ b/remotes/docker/fetcher.go @@ -51,10 +51,10 @@ func (r dockerFetcher) Fetch(ctx context.Context, desc ocispec.Descriptor) (io.R } if resp.StatusCode > 299 { + resp.Body.Close() if resp.StatusCode == http.StatusNotFound { continue // try one of the other urls. } - resp.Body.Close() return nil, errors.Errorf("unexpected status code %v: %v", u, resp.Status) }