From ba93e3a228c8d9b73607da72656f652bc0e9fc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 20 Aug 2019 12:40:09 +0200 Subject: [PATCH] qemuBuildHotpluggableCPUProps: use VIR_RETURN_PTR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets us get rid of the error label. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 1b5cde6ec7..5e05916b23 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11047,33 +11047,29 @@ virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu) { qemuDomainVcpuPrivatePtr vcpupriv = QEMU_DOMAIN_VCPU_PRIVATE(vcpu); - virJSONValuePtr ret = NULL; + VIR_AUTOPTR(virJSONValue) ret = NULL; if (virJSONValueObjectCreate(&ret, "s:driver", vcpupriv->type, "s:id", vcpupriv->alias, NULL) < 0) - goto error; + return NULL; if (vcpupriv->socket_id != -1 && virJSONValueObjectAdd(ret, "i:socket-id", vcpupriv->socket_id, NULL) < 0) - goto error; + return NULL; if (vcpupriv->core_id != -1 && virJSONValueObjectAdd(ret, "i:core-id", vcpupriv->core_id, NULL) < 0) - goto error; + return NULL; if (vcpupriv->thread_id != -1 && virJSONValueObjectAdd(ret, "i:thread-id", vcpupriv->thread_id, NULL) < 0) - goto error; + return NULL; if (vcpupriv->node_id != -1 && virJSONValueObjectAdd(ret, "i:node-id", vcpupriv->node_id, NULL) < 0) - goto error; + return NULL; - return ret; - - error: - virJSONValueFree(ret); - return NULL; + VIR_RETURN_PTR(ret); }