diff --git a/ipam/allocator.go b/ipam/allocator.go index 478c6545..f3388a67 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -321,11 +321,11 @@ func (alloc *Allocator) ContainerStarted(ident string) { } func (alloc *Allocator) PruneOwned(ids []string) { + idmap := make(map[string]struct{}, len(ids)) + for _, id := range ids { + idmap[id] = struct{}{} + } alloc.actionChan <- func() { - idmap := make(map[string]struct{}, len(ids)) - for _, id := range ids { - idmap[id] = struct{}{} - } alloc.pruneOwned(idmap) } }