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 <denys@sourced.tech>
This commit is contained in:
Denys Smirnov 2018-03-06 23:31:31 +01:00
parent ce80fa0a64
commit 3d26fc3fd7
1 changed files with 1 additions and 1 deletions

View File

@ -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()