From 929cf433b9c8e987af5f7f3ca3ce717e1e3eda53 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sun, 26 Jun 2016 00:34:34 -0400 Subject: [PATCH] fix chDesc race --- connection.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connection.go b/connection.go index 68b4e0b31..6c8ccd435 100644 --- a/connection.go +++ b/connection.go @@ -115,7 +115,8 @@ func NewMConnection(config cfg.Config, conn net.Conn, chDescs []*ChannelDescript var channels = []*Channel{} for _, desc := range chDescs { - channel := newChannel(mconn, desc) + descCopy := *desc // copy the desc else unsafe access across connections + channel := newChannel(mconn, &descCopy) channelsIdx[channel.id] = channel channels = append(channels, channel) }