Merge pull request #17695 from dfr/freebsd-cleanup

libpod: avoid nil pointer dereference in (*Container).Cleanup
This commit is contained in:
OpenShift Merge Robot
2023-03-06 17:11:03 +01:00
committed by GitHub

View File

@ -788,12 +788,14 @@ func (c *Container) Cleanup(ctx context.Context) error {
// make sure all the container processes are terminated if we are running without a pid namespace.
hasPidNs := false
if c.config.Spec.Linux != nil {
for _, i := range c.config.Spec.Linux.Namespaces {
if i.Type == spec.PIDNamespace {
hasPidNs = true
break
}
}
}
if !hasPidNs {
// do not fail on errors
_ = c.ociRuntime.KillContainer(c, uint(unix.SIGKILL), true)