Use g_auto and remove pointless labels. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- 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 174352a5a2..a80c172d71 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5510,7 +5510,7 @@ virQEMUCapsLoadFile(const char *filename, void *privData, bool *outdated) { - virQEMUCaps *qemuCaps = virQEMUCapsNewBinary(binary); + g_autoptr(virQEMUCaps) qemuCaps = virQEMUCapsNewBinary(binary); virQEMUCapsCachePriv *priv = privData; int ret; @@ -5519,17 +5519,13 @@ virQEMUCapsLoadFile(const char *filename, ret = virQEMUCapsLoadCache(priv->hostArch, qemuCaps, filename, false); if (ret < 0) - goto error; + return NULL; if (ret == 1) { *outdated = true; - goto error; + return NULL; } - return qemuCaps; - - error: - virObjectUnref(qemuCaps); - return NULL; + return g_steal_pointer(&qemuCaps); } -- 2.31.1