From 62b06a003c870cf18488fc207252370cc05b6b83 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Fri, 5 Aug 2016 10:00:54 +0200 Subject: [PATCH] fix a race condition in stream.Write --- stream.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream.go b/stream.go index 4bf326797..ecfc5de8d 100644 --- a/stream.go +++ b/stream.go @@ -138,7 +138,7 @@ func (s *stream) Write(p []byte) (int, error) { s.doneWritingOrErrCond.Wait() } - s.mutex.Unlock() + defer s.mutex.Unlock() if s.err != nil { return 0, s.err }