浏览代码

graphdriver: Fix RefCounter memory leak

Signed-off-by: WANG Chao <chao.wang@ucloud.cn>
WANG Chao 7 年之前
父节点
当前提交
9015a05606
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      daemon/graphdriver/counter.go

+ 3 - 0
daemon/graphdriver/counter.go

@@ -54,6 +54,9 @@ func (c *RefCounter) incdec(path string, infoOp func(minfo *minfo)) int {
 	}
 	infoOp(m)
 	count := m.count
+	if count <= 0 {
+		delete(c.counts, path)
+	}
 	c.mu.Unlock()
 	return count
 }