Skip to content

Commit

Permalink
Merge pull request containers#16166 from misuto/main
Browse files Browse the repository at this point in the history
Change to correct break statements to prevent infinite recursion causing OOM
  • Loading branch information
openshift-merge-robot authored Oct 15, 2022
2 parents c5c57f0 + 783b4e9 commit d21a356
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/bindings/images/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,
dec := json.NewDecoder(response.Body)
var images []string
var pullErrors []error
LOOP:
for {
var report entities.ImagePullReport
if err := dec.Decode(&report); err != nil {
Expand All @@ -80,7 +81,7 @@ func Pull(ctx context.Context, rawImage string, options *PullOptions) ([]string,

select {
case <-response.Request.Context().Done():
break
break LOOP
default:
// non-blocking select
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/bindings/images/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO
}

dec := json.NewDecoder(response.Body)
LOOP:
for {
var report entities.ImagePushReport
if err := dec.Decode(&report); err != nil {
Expand All @@ -78,7 +79,7 @@ func Push(ctx context.Context, source string, destination string, options *PushO

select {
case <-response.Request.Context().Done():
break
break LOOP
default:
// non-blocking select
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindings/manifests/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func Push(ctx context.Context, name, destination string, options *images.PushOpt

select {
case <-response.Request.Context().Done():
break
return "", context.Canceled
default:
// non-blocking select
}
Expand Down

0 comments on commit d21a356

Please sign in to comment.