1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

virQEMUCapsInitQMPArch: Refactor cleanup

Switch to using the 'g_auto*' helpers.

Signed-off-by: Yi Li <yili@winhong.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Yi Li 2021-03-10 15:46:29 +08:00 committed by Ján Tomko
parent 16634feb1d
commit 7dfa87aed3

View File

@ -5044,23 +5044,18 @@ static int
virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
{
char *archstr = NULL;
int ret = -1;
g_autofree char *archstr = NULL;
if (!(archstr = qemuMonitorGetTargetArch(mon)))
goto cleanup;
return -1;
if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown QEMU arch %s"), archstr);
goto cleanup;
return -1;
}
ret = 0;
cleanup:
VIR_FREE(archstr);
return ret;
return 0;
}