Skip to content

Commit

Permalink
infinite loop concurrency bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zricethezav committed Oct 29, 2021
1 parent 1ee22f3 commit 9487daa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gitdiff/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ func Parse(r io.Reader) (<-chan *File, error) {
}

go func() {
defer close(out)

ph := &PatchHeader{}
for {
file, pre, err := p.ParseNextFileHeader()
if err != nil {
out <- file
return
}

Expand Down Expand Up @@ -59,7 +60,6 @@ func Parse(r io.Reader) (<-chan *File, error) {
file.PatchHeader = ph
out <- file
}
close(out)
}()

return out, nil
Expand Down

0 comments on commit 9487daa

Please sign in to comment.