Explorar o código

graphdriver: Fix RefCounter memory leak

Signed-off-by: WANG Chao <chao.wang@ucloud.cn>
WANG Chao %!s(int64=7) %!d(string=hai) anos
pai
achega
9015a05606
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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
 }