Skip to content

Commit f9a1123

Browse files
Merge pull request cri-o#5448 from haircommander/fix-cgroupv2-test
server: fix segfault when using cgroupv2
2 parents 143babd + cbfab09 commit f9a1123

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/container_create_linux.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,10 @@ func (s *Server) createSandboxContainer(ctx context.Context, ctr ctrIface.Contai
395395
}
396396
}
397397

398-
if node.CgroupIsV2() {
398+
if node.CgroupIsV2() && len(resources.Unified) != 0 {
399+
if specgen.Config.Linux.Resources.Unified == nil {
400+
specgen.Config.Linux.Resources.Unified = make(map[string]string, len(resources.Unified))
401+
}
399402
for key, value := range resources.Unified {
400403
specgen.Config.Linux.Resources.Unified[key] = value
401404
}

0 commit comments

Comments
 (0)