Skip to content

Commit 7bd8dcd

Browse files
committed
Fix potential containerd panic.
Signed-off-by: Lantao Liu <[email protected]>
1 parent ca65dc9 commit 7bd8dcd

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

process.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ func (p *process) Start(ctx context.Context) error {
111111
ExecID: p.id,
112112
})
113113
if err != nil {
114-
p.io.Cancel()
115-
p.io.Wait()
116-
p.io.Close()
114+
if p.io != nil {
115+
p.io.Cancel()
116+
p.io.Wait()
117+
p.io.Close()
118+
}
117119
return errdefs.FromGRPC(err)
118120
}
119121
p.pid = r.Pid

task.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ func (t *task) Start(ctx context.Context) error {
189189
ContainerID: t.id,
190190
})
191191
if err != nil {
192-
t.io.Cancel()
193-
t.io.Close()
192+
if t.io != nil {
193+
t.io.Cancel()
194+
t.io.Close()
195+
}
194196
return errdefs.FromGRPC(err)
195197
}
196198
t.pid = r.Pid

0 commit comments

Comments
 (0)