From 55564fda1d119bbbec46c0af98af96c30f37a355 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Mon, 15 Aug 2016 13:59:12 -0700 Subject: [PATCH] network: fix race in read access to map Signed-off-by: Alexander Morozov --- libnetwork/network.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnetwork/network.go b/libnetwork/network.go index 5c83bef903..ffdc232486 100644 --- a/libnetwork/network.go +++ b/libnetwork/network.go @@ -1110,8 +1110,8 @@ func (n *network) getSvcRecords(ep *endpoint) []etchosts.Record { epName := ep.Name() n.ctrlr.Lock() + defer n.ctrlr.Unlock() sr, _ := n.ctrlr.svcRecords[n.id] - n.ctrlr.Unlock() for h, ip := range sr.svcMap { if strings.Split(h, ".")[0] == epName {