Skip to content

Commit

Permalink
fix a possible race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 19, 2019
1 parent 3627305 commit 3b54c0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ func (s *Stream) WriteTo(w io.Writer) (n int64, err error) {

if buf != nil {
nw, ew := w.Write(buf)
defaultAllocator.Put(buf)
s.sess.returnTokens(len(buf))
defaultAllocator.Put(buf)
if nw > 0 {
n += int64(nw)
}
Expand Down

0 comments on commit 3b54c0f

Please sign in to comment.