mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +08:00
Merge pull request #17695 from dfr/freebsd-cleanup
libpod: avoid nil pointer dereference in (*Container).Cleanup
This commit is contained in:
@ -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.
|
// make sure all the container processes are terminated if we are running without a pid namespace.
|
||||||
hasPidNs := false
|
hasPidNs := false
|
||||||
|
if c.config.Spec.Linux != nil {
|
||||||
for _, i := range c.config.Spec.Linux.Namespaces {
|
for _, i := range c.config.Spec.Linux.Namespaces {
|
||||||
if i.Type == spec.PIDNamespace {
|
if i.Type == spec.PIDNamespace {
|
||||||
hasPidNs = true
|
hasPidNs = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if !hasPidNs {
|
if !hasPidNs {
|
||||||
// do not fail on errors
|
// do not fail on errors
|
||||||
_ = c.ociRuntime.KillContainer(c, uint(unix.SIGKILL), true)
|
_ = c.ociRuntime.KillContainer(c, uint(unix.SIGKILL), true)
|
||||||
|
Reference in New Issue
Block a user