Fix potential containerd panic.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2019-02-05 00:38:02 -08:00
parent ca65dc9316
commit 7bd8dcd0d3
2 changed files with 9 additions and 5 deletions

View File

@ -111,9 +111,11 @@ func (p *process) Start(ctx context.Context) error {
ExecID: p.id,
})
if err != nil {
p.io.Cancel()
p.io.Wait()
p.io.Close()
if p.io != nil {
p.io.Cancel()
p.io.Wait()
p.io.Close()
}
return errdefs.FromGRPC(err)
}
p.pid = r.Pid

View File

@ -189,8 +189,10 @@ func (t *task) Start(ctx context.Context) error {
ContainerID: t.id,
})
if err != nil {
t.io.Cancel()
t.io.Close()
if t.io != nil {
t.io.Cancel()
t.io.Close()
}
return errdefs.FromGRPC(err)
}
t.pid = r.Pid