diff --git a/conn.go b/conn.go index 6adb94618e..2d2a81f9cc 100644 --- a/conn.go +++ b/conn.go @@ -210,16 +210,16 @@ func (c *connect) close() error { c.closed = true c.mutexClose.Unlock() + if err := c.conn.Close(); err != nil { + return err + } + c.buffer = nil c.mutex.Lock() c.reader = nil c.mutex.Unlock() - if err := c.conn.Close(); err != nil { - return err - } - return nil }