mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Remove goroutine leak upon error
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume@charmes.net> (github: creack)
This commit is contained in:
parent
0a6d9035cf
commit
721562f296
2 changed files with 9 additions and 0 deletions
|
@ -168,6 +168,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba
|
|||
// Poll lxc for RUNNING status
|
||||
pid, err := d.waitForStart(c, waitLock)
|
||||
if err != nil {
|
||||
if c.Process != nil {
|
||||
c.Process.Kill()
|
||||
}
|
||||
return -1, err
|
||||
}
|
||||
c.ContainerPid = pid
|
||||
|
|
|
@ -2384,7 +2384,13 @@ func (srv *Server) IsRunning() bool {
|
|||
}
|
||||
|
||||
func (srv *Server) Close() error {
|
||||
if srv == nil {
|
||||
return nil
|
||||
}
|
||||
srv.SetRunning(false)
|
||||
if srv.runtime == nil {
|
||||
return nil
|
||||
}
|
||||
return srv.runtime.Close()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue