From 3d26fc3fd7dfc9ad6b529b14003f6977b7ffc726 Mon Sep 17 00:00:00 2001 From: Denys Smirnov Date: Tue, 6 Mar 2018 23:31:31 +0100 Subject: [PATCH] cgroups/fs: fix NPE on Destroy than no cgroups are set Currently Manager accepts nil cgroups when calling Apply, but it will panic then trying to call Destroy with the same config. Signed-off-by: Denys Smirnov --- libcontainer/cgroups/fs/apply_raw.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index 43bdccf3..6d9123dc 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -161,7 +161,7 @@ func (m *Manager) Apply(pid int) (err error) { } func (m *Manager) Destroy() error { - if m.Cgroups.Paths != nil { + if m.Cgroups == nil || m.Cgroups.Paths != nil { return nil } m.mu.Lock()