On Thu, Sep 22, 2022 at 21:00:38 +0800, luzhipeng wrote:
From: lu zhipeng <luzhipeng(a)cestc.cn>
virTypedParamsAddString may return -1 but alloc params,
so free it.
Signed-off-by: lu zhipeng <luzhipeng(a)cestc.cn>
---
src/qemu/qemu_driver.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 94b70872d4..c4501cd705 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4473,11 +4473,13 @@ qemuDomainPinVcpuLive(virDomainObj *vm,
goto cleanup;
event = virDomainEventTunableNewFromObj(vm, eventParams, eventNparams);
This call consumes eventParams which should not be used afterwards. Thus
instead of
-
+ eventNparams = 0;
we should set eventParams = NULL here...
ret = 0;
cleanup:
virObjectEventStateQueue(driver->domainEventState, event);
... and call virTypedParamsFree unconditionally.
+ if (eventNparams)
+ virTypedParamsFree(eventParams, eventNparams);
return ret;
}
Alternatively, virDomainEventTunableNew could be changed to get
virTypedParameterPtr *params and set ¶ms = NULL itself.
Jirka