mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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:
parent
16634feb1d
commit
7dfa87aed3
@ -5044,23 +5044,18 @@ static int
|
|||||||
virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps,
|
||||||
qemuMonitorPtr mon)
|
qemuMonitorPtr mon)
|
||||||
{
|
{
|
||||||
char *archstr = NULL;
|
g_autofree char *archstr = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (!(archstr = qemuMonitorGetTargetArch(mon)))
|
if (!(archstr = qemuMonitorGetTargetArch(mon)))
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
|
if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Unknown QEMU arch %s"), archstr);
|
_("Unknown QEMU arch %s"), archstr);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(archstr);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user