mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
allocateNetwork: fix network sandbox not cleaned up on failure
The defer function was checking for the local `err` variable, not on the error that was returned by the function. As a result, the sandbox would never be cleaned up for containers that used "none" networking, and a failiure occured during setup. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e5a679cfd2
commit
b98b8df886
1 changed files with 2 additions and 2 deletions
|
@ -526,7 +526,7 @@ func (daemon *Daemon) updateContainerNetworkSettings(container *container.Contai
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (daemon *Daemon) allocateNetwork(container *container.Container) error {
|
func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
controller := daemon.netController
|
controller := daemon.netController
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) error {
|
||||||
}
|
}
|
||||||
updateSandboxNetworkSettings(container, sb)
|
updateSandboxNetworkSettings(container, sb)
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if retErr != nil {
|
||||||
sb.Delete()
|
sb.Delete()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue