Skip to content

Commit e6d4da0

Browse files
authored
Merge pull request containerd#5717 from thaJeztah/1.4_backport_docker_push_close_body
[release/1.4 backport] Fix missing Body.Close() calls on push to docker remote
2 parents 32c84bf + 591744a commit e6d4da0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

remotes/docker/pusher.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ func (p dockerPusher) Push(ctx context.Context, desc ocispec.Descriptor) (conten
155155
return nil, err
156156
}
157157
}
158+
defer resp.Body.Close()
158159

159160
switch resp.StatusCode {
160161
case http.StatusOK, http.StatusAccepted, http.StatusNoContent:
@@ -338,6 +339,7 @@ func (pw *pushWriter) Commit(ctx context.Context, size int64, expected digest.Di
338339
if resp == nil {
339340
return errors.New("no response")
340341
}
342+
defer resp.Body.Close()
341343

342344
// 201 is specified return status, some registries return
343345
// 200, 202 or 204.

0 commit comments

Comments
 (0)