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) }