79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
76 lines
2.3 KiB
Diff
76 lines
2.3 KiB
Diff
From 4f4ebf64009e402db79bf53db1226966bf5c0a99 Mon Sep 17 00:00:00 2001
|
|
From: Feng Ni <fengni@huawei.com>
|
|
Date: Wed, 15 Apr 2020 11:11:16 +0800
|
|
Subject: qemu: fix potential memory leak
|
|
|
|
function virTypedParamsAddString may return -1 but alloc params,
|
|
so invoker should free it.
|
|
|
|
Signed-off-by: Feng Ni <fengni@huawei.com>
|
|
Signed-off-by: Xu Yandong <xuyandong2@huawei.com>
|
|
---
|
|
src/qemu/qemu_driver.c | 12 ++++++++++++
|
|
1 file changed, 12 insertions(+)
|
|
|
|
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
index ff97f10..8bc5368 100644
|
|
--- a/src/qemu/qemu_driver.c
|
|
+++ b/src/qemu/qemu_driver.c
|
|
@@ -5175,6 +5175,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
|
goto cleanup;
|
|
|
|
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
|
|
+ eventParams = NULL;
|
|
+ eventNparams = 0;
|
|
|
|
ret = 0;
|
|
|
|
@@ -5182,6 +5184,8 @@ qemuDomainPinVcpuLive(virDomainObjPtr vm,
|
|
virBitmapFree(tmpmap);
|
|
virCgroupFree(&cgroup_vcpu);
|
|
virObjectEventStateQueue(driver->domainEventState, event);
|
|
+ if (eventParams)
|
|
+ virTypedParamsFree(eventParams, eventNparams);
|
|
return ret;
|
|
}
|
|
|
|
@@ -5388,6 +5392,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
|
|
goto endjob;
|
|
|
|
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
|
|
+ eventParams = NULL;
|
|
+ eventNparams = 0;
|
|
}
|
|
|
|
if (persistentDef) {
|
|
@@ -5409,6 +5415,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
|
|
cleanup:
|
|
if (cgroup_emulator)
|
|
virCgroupFree(&cgroup_emulator);
|
|
+ if (eventParams)
|
|
+ virTypedParamsFree(eventParams, eventNparams);
|
|
virObjectEventStateQueue(driver->domainEventState, event);
|
|
virBitmapFree(pcpumap);
|
|
virDomainObjEndAPI(&vm);
|
|
@@ -5871,6 +5879,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
|
|
goto endjob;
|
|
|
|
event = virDomainEventTunableNewFromDom(dom, eventParams, eventNparams);
|
|
+ eventParams = NULL;
|
|
+ eventNparams = 0;
|
|
}
|
|
|
|
if (persistentDef) {
|
|
@@ -5902,6 +5912,8 @@ qemuDomainPinIOThread(virDomainPtr dom,
|
|
cleanup:
|
|
if (cgroup_iothread)
|
|
virCgroupFree(&cgroup_iothread);
|
|
+ if (eventParams)
|
|
+ virTypedParamsFree(eventParams, eventNparams);
|
|
virObjectEventStateQueue(driver->domainEventState, event);
|
|
virBitmapFree(pcpumap);
|
|
virDomainObjEndAPI(&vm);
|
|
--
|
|
2.23.0
|
|
|