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@xxxxxxxxxx> --- 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 ecd96efb0a..bc498e4b10 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -869,8 +869,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.18.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list