From e995670935118ad7ff485aee7fd3d4767e4c3e29 Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Wed, 18 Feb 2015 11:27:38 -0800 Subject: [PATCH] Fix possible panic on killing container Signed-off-by: Alexander Morozov --- daemon/execdriver/native/driver.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/daemon/execdriver/native/driver.go b/daemon/execdriver/native/driver.go index 533e6d61ef..e5f24524b4 100644 --- a/daemon/execdriver/native/driver.go +++ b/daemon/execdriver/native/driver.go @@ -4,6 +4,7 @@ package native import ( "encoding/json" + "errors" "fmt" "io" "io/ioutil" @@ -173,6 +174,9 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba } func (d *driver) Kill(p *execdriver.Command, sig int) error { + if p.ProcessConfig.Process == nil { + return errors.New("exec: not started") + } return syscall.Kill(p.ProcessConfig.Process.Pid, syscall.Signal(sig)) }