mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuProcessUpdateAndVerifyCPU: Refactor cleanup
Use automatic memory clearing and remove the 'ret' variable. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3ac3b3e8fb
commit
476e864186
@ -4335,25 +4335,19 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriver *driver,
|
|||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
qemuDomainAsyncJob asyncJob)
|
qemuDomainAsyncJob asyncJob)
|
||||||
{
|
{
|
||||||
virCPUData *cpu = NULL;
|
g_autoptr(virCPUData) cpu = NULL;
|
||||||
virCPUData *disabled = NULL;
|
g_autoptr(virCPUData) disabled = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0)
|
if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuProcessVerifyCPU(vm, cpu) < 0)
|
if (qemuProcessVerifyCPU(vm, cpu) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0)
|
if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
virCPUDataFree(cpu);
|
|
||||||
virCPUDataFree(disabled);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user