Use g_auto and remove pointless labels. Signed-off-by: Ján Tomko <jto...@redhat.com> --- src/qemu/qemu_capabilities.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 380d0a5694..fecd332604 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1953,7 +1953,7 @@ virQEMUCapsAccelCopy(virQEMUCapsAccel *dst, virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) { - virQEMUCaps *ret = virQEMUCapsNewBinary(qemuCaps->binary); + g_autoptr(virQEMUCaps) ret = virQEMUCapsNewBinary(qemuCaps->binary); size_t i; if (!ret) @@ -1980,7 +1980,7 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) if (virQEMUCapsAccelCopy(&ret->kvm, &qemuCaps->kvm) < 0 || virQEMUCapsAccelCopy(&ret->tcg, &qemuCaps->tcg) < 0) - goto error; + return NULL; ret->gicCapabilities = g_new0(virGICCapability, qemuCaps->ngicCapabilities); ret->ngicCapabilities = qemuCaps->ngicCapabilities; @@ -1990,13 +1990,9 @@ virQEMUCaps *virQEMUCapsNewCopy(virQEMUCaps *qemuCaps) if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SEV_GUEST) && virQEMUCapsSEVInfoCopy(&ret->sevCapabilities, qemuCaps->sevCapabilities) < 0) - goto error; + return NULL; - return ret; - - error: - virObjectUnref(ret); - return NULL; + return g_steal_pointer(&ret); } -- 2.31.1