浏览代码

Fix map access race in populatedEndpoints

Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
Jana Radhakrishnan 8 年之前
父节点
当前提交
eae800acf0
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      libnetwork/sandbox.go

+ 2 - 1
libnetwork/sandbox.go

@@ -848,8 +848,9 @@ func (sb *sandbox) clearNetworkResources(origEp *endpoint) error {
 		releaseOSSboxResources(osSbox, ep)
 	}
 
-	delete(sb.populatedEndpoints, ep.ID())
 	sb.Lock()
+	delete(sb.populatedEndpoints, ep.ID())
+
 	if len(sb.endpoints) == 0 {
 		// sb.endpoints should never be empty and this is unexpected error condition
 		// We log an error message to note this down for debugging purposes.