diff --git a/remotes/docker/pusher.go b/remotes/docker/pusher.go index 8028d1421..eae5a251d 100644 --- a/remotes/docker/pusher.go +++ b/remotes/docker/pusher.go @@ -190,6 +190,7 @@ func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, ref str return nil, err } } + defer resp.Body.Close() switch resp.StatusCode { case http.StatusOK, http.StatusAccepted, http.StatusNoContent: @@ -382,6 +383,7 @@ func (pw *pushWriter) Commit(ctx context.Context, size int64, expected digest.Di if resp.err != nil { return resp.err } + defer resp.Response.Body.Close() // 201 is specified return status, some registries return // 200, 202 or 204.