The cleanup to sysinfo package introduced a regression.
If memory cgroup isn't supported and --memory is specified when
starting a container, we should return info instead of nil in
checkCgroupMem(), otherwise we'll access a nil pointer.
Signed-off-by: Zefan Li <lizefan@huawei.com>
| ... | ... |
@@ -38,7 +38,7 @@ func checkCgroupMem(quiet bool) *cgroupMemInfo {
|
| 38 | 38 |
if !quiet {
|
| 39 | 39 |
logrus.Warnf("Your kernel does not support cgroup memory limit: %v", err)
|
| 40 | 40 |
} |
| 41 |
- return nil |
|
| 41 |
+ return info |
|
| 42 | 42 |
} |
| 43 | 43 |
info.MemoryLimit = true |
| 44 | 44 |
|
| ... | ... |
@@ -61,7 +61,7 @@ func checkCgroupCpu(quiet bool) *cgroupCpuInfo {
|
| 61 | 61 |
if !quiet {
|
| 62 | 62 |
logrus.Warn(err) |
| 63 | 63 |
} |
| 64 |
- return nil |
|
| 64 |
+ return info |
|
| 65 | 65 |
} |
| 66 | 66 |
|
| 67 | 67 |
info.CpuCfsPeriod = cgroupEnabled(mountPoint, "cpu.cfs_period_us") |