1 Star 0 Fork 39

duyiwei/podman_1

forked from src-openEuler/podman 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-Fix-the-invalid-memory-address-reference.patch 1.19 KB
一键复制 编辑 原始数据 按行查看 历史
fu-shanqing 提交于 2022-07-05 16:28 . update to 3.4.4
From a9e6a71f9435a50c582993e946be4d53828bb48d Mon Sep 17 00:00:00 2001
From: maminjie <maminjie1@huawei.com>
Date: Sat, 13 Mar 2021 16:03:03 +0800
Subject: [PATCH] Fix the invalid memory address or nil pointer reference
---
libpod/stats.go | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/libpod/stats.go b/libpod/stats.go
index c58a461..97a2169 100644
--- a/libpod/stats.go
+++ b/libpod/stats.go
@@ -68,9 +68,11 @@
stats.CPU = calculateCPUPercent(cgroupStats, previousCPU, now, previousStats.SystemNano)
stats.AvgCPU = calculateAvgCPU(stats.CPU, previousStats.AvgCPU, previousStats.DataPoints)
stats.DataPoints = previousStats.DataPoints + 1
- stats.MemUsage = cgroupStats.Memory.Usage.Usage
- stats.MemLimit = c.getMemLimit()
- stats.MemPerc = (float64(stats.MemUsage) / float64(stats.MemLimit)) * 100
+ if cgroupStats.Memory != (cgroups.MemoryMetrics{}){
+ stats.MemUsage = cgroupStats.Memory.Usage.Usage
+ stats.MemLimit = c.getMemLimit()
+ stats.MemPerc = (float64(stats.MemUsage) / float64(stats.MemLimit)) * 100
+ }
stats.PIDs = 0
if conState == define.ContainerStateRunning || conState == define.ContainerStatePaused {
stats.PIDs = cgroupStats.Pids.Current
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/duyiwei7w/podman_1.git
git@gitee.com:duyiwei7w/podman_1.git
duyiwei7w
podman_1
podman_1
master

搜索帮助