1 Star 0 Fork 71

Fisher/libvirt-rpm

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libvirt-cgroup-cleanup-eventParams-when-virTypedParamsAddULL.patch 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
From 432afe3f14418ea5d2d69e62d678ef5bb08caaa1 Mon Sep 17 00:00:00 2001
From: Xu Yandong <xuyandong2@huawei.com>
Date: Wed, 15 Apr 2020 11:55:43 +0800
Subject: cgroup: cleanup eventParams when virTypedParamsAddULLong failed
Function virTypedParamsAddULLong use realloc to gain memory,
and doesn't free it when failed. so we need free eventParams to
prevent a memory leak.
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
---
src/qemu/qemu_cgroup.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index c0e30f6..057f871 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -904,8 +904,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
if (virTypedParamsAddULLong(&eventParams, &eventNparams,
&eventMaxparams,
VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES,
- val) < 0)
+ val) < 0) {
+ if (eventParams)
+ virTypedParamsFree(eventParams, eventNparams);
return -1;
+ }
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
}
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wengyu1/libvirt-rpm.git
git@gitee.com:wengyu1/libvirt-rpm.git
wengyu1
libvirt-rpm
libvirt-rpm
master

搜索帮助