Skip to content

Commit

Permalink
Fixing memory leak in First(Enumerable) impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
marstr committed Jul 18, 2017
1 parent 1a144db commit f389671
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,10 @@ func First(subject Enumerable) (retval interface{}, err error) {

var isOpen bool

if retval, isOpen = <-subject.Enumerate(nil); isOpen {
if retval, isOpen = <-subject.Enumerate(done); isOpen {
err = nil
}

subject.Enumerate(done)
close(done)

return
}
Expand Down

0 comments on commit f389671

Please sign in to comment.