代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 18bcc450bbd6db8b124a8e6e218bde9846e5c3d5 Mon Sep 17 00:00:00 2001
From: Yan Wang <wangyan122@huawei.com>
Date: Thu, 24 Mar 2022 12:10:30 +0800
Subject: [PATCH 03/16] :qemuMonitorJSONMakeCommandInternal: Clear @arguments
when stolen
All callers of qemuMonitorJSONMakeCommandInternal will benefit from
making @arguments a double pointer and passing it to
virJSONValueObjectCreate directly which will clear it if it steals the
value.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Yan Wang <wangyan122@huawei.com>
---
src/qemu/qemu_monitor_json.c | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index ce7f35e2ca..cc6644c9c3 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -546,20 +546,18 @@ qemuMonitorJSONTransactionAdd(virJSONValuePtr actions,
*
* Create a JSON object used on the QMP monitor to call a command.
*
- * Note that @arguments is always consumed and should not be referenced after
- * the call to this function.
+ * Note that @arguments is consumed and cleared.
*/
static virJSONValuePtr
qemuMonitorJSONMakeCommandInternal(const char *cmdname,
- virJSONValuePtr arguments)
+ virJSONValuePtr *arguments)
{
virJSONValuePtr ret = NULL;
ignore_value(virJSONValueObjectCreate(&ret,
"s:execute", cmdname,
- "A:arguments", &arguments, NULL));
+ "A:arguments", arguments, NULL));
- virJSONValueFree(arguments);
return ret;
}
@@ -569,7 +567,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
...)
{
virJSONValuePtr obj = NULL;
- virJSONValuePtr jargs = NULL;
+ g_autoptr(virJSONValue) jargs = NULL;
va_list args;
va_start(args, cmdname);
@@ -577,7 +575,7 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
if (virJSONValueObjectCreateVArgs(&jargs, args) < 0)
goto cleanup;
- obj = qemuMonitorJSONMakeCommandInternal(cmdname, jargs);
+ obj = qemuMonitorJSONMakeCommandInternal(cmdname, &jargs);
cleanup:
va_end(args);
@@ -3469,9 +3467,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- virJSONValuePtr par = g_steal_pointer(params);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", par)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", params)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
@@ -3998,9 +3995,8 @@ qemuMonitorJSONAddNetdev(qemuMonitorPtr mon,
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- virJSONValuePtr pr = g_steal_pointer(props);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("netdev_add", pr)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("netdev_add", props)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
@@ -4431,9 +4427,8 @@ qemuMonitorJSONAddObject(qemuMonitorPtr mon,
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- virJSONValuePtr pr = g_steal_pointer(props);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("object-add", pr)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("object-add", props)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
@@ -8812,9 +8807,8 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- virJSONValuePtr pr = g_steal_pointer(props);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-add", pr)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-add", props)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
@@ -8833,9 +8827,8 @@ qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
- virJSONValuePtr pr = g_steal_pointer(props);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", props)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。