Fix race in contStore.List

Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Upstream-commit: 0b3fe5544266b6f9657ecd87989b85b535cc63e1
Component: engine
This commit is contained in:
Alexandr Morozov
2014-06-11 15:23:33 +04:00
parent b71d34e96b
commit ab194686ba
+2
View File
@@ -72,9 +72,11 @@ func (c *contStore) Delete(id string) {
func (c *contStore) List() []*Container {
containers := new(History)
c.Lock()
for _, cont := range c.s {
containers.Add(cont)
}
c.Unlock()
containers.Sort()
return *containers
}