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:
Guillaume J. Charmes
2014-03-11 23:46:36 -06:00
committed by Tianon Gravi
parent 143c9707a9
commit 4bb1950089
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -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
+6
View File
@@ -2390,7 +2390,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()
}