Skip to content

Commit b6aa5a4

Browse files
authored
Merge pull request #5712 from coryb/docker-push-close-body
Fix missing Body.Close() calls on push to docker remote
2 parents a8ef1fc + 894b6ae commit b6aa5a4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

remotes/docker/pusher.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ func (p dockerPusher) push(ctx context.Context, desc ocispec.Descriptor, ref str
190190
return nil, err
191191
}
192192
}
193+
defer resp.Body.Close()
193194

194195
switch resp.StatusCode {
195196
case http.StatusOK, http.StatusAccepted, http.StatusNoContent:
@@ -382,6 +383,7 @@ func (pw *pushWriter) Commit(ctx context.Context, size int64, expected digest.Di
382383
if resp.err != nil {
383384
return resp.err
384385
}
386+
defer resp.Response.Body.Close()
385387

386388
// 201 is specified return status, some registries return
387389
// 200, 202 or 204.

0 commit comments

Comments
 (0)