allocateNetwork: don't assign unneeded variables
allocateNetwork() can return early, in which case these variables were unused.
@@ -527,13 +527,15 @@ func (daemon *Daemon) updateContainerNetworkSettings(container *container.Contai
}
func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr error) {
- start := time.Now()
- controller := daemon.netController
-
if daemon.netController == nil {
return nil
}
+ var (
+ start = time.Now()
+ controller = daemon.netController
+ )
+
// Cleanup any stale sandbox left over due to ungraceful daemon shutdown
if err := controller.SandboxDestroy(container.ID); err != nil {
logrus.Errorf("failed to cleanup up stale network sandbox for container %s", container.ID)
