36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
From d5ac07dee8c9337878ed0085e940c86d3f2ade0b Mon Sep 17 00:00:00 2001
|
|
From: Xu Yandong <xuyandong2@huawei.com>
|
|
Date: Thu, 25 Jul 2019 16:47:50 +0800
|
|
Subject: [PATCH] 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 ca76c4f..8a00703 100644
|
|
--- a/src/qemu/qemu_cgroup.c
|
|
+++ b/src/qemu/qemu_cgroup.c
|
|
@@ -870,8 +870,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.19.1
|
|
|