Skip to content

Commit 9487daa

Browse files
committed
infinite loop concurrency bug
1 parent 1ee22f3 commit 9487daa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitdiff/parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ func Parse(r io.Reader) (<-chan *File, error) {
2727
}
2828

2929
go func() {
30+
defer close(out)
31+
3032
ph := &PatchHeader{}
3133
for {
3234
file, pre, err := p.ParseNextFileHeader()
3335
if err != nil {
34-
out <- file
3536
return
3637
}
3738

@@ -59,7 +60,6 @@ func Parse(r io.Reader) (<-chan *File, error) {
5960
file.PatchHeader = ph
6061
out <- file
6162
}
62-
close(out)
6363
}()
6464

6565
return out, nil

0 commit comments

Comments
 (0)