Use automatic memory clearing and remove the 'ret' variable. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_process.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ea586e54c1..d080ab1c49 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4335,25 +4335,19 @@ qemuProcessUpdateAndVerifyCPU(virQEMUDriver *driver, virDomainObj *vm, qemuDomainAsyncJob asyncJob) { - virCPUData *cpu = NULL; - virCPUData *disabled = NULL; - int ret = -1; + g_autoptr(virCPUData) cpu = NULL; + g_autoptr(virCPUData) disabled = NULL; if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < 0) - goto cleanup; + return -1; if (qemuProcessVerifyCPU(vm, cpu) < 0) - goto cleanup; + return -1; if (qemuProcessUpdateLiveGuestCPU(vm, cpu, disabled) < 0) - goto cleanup; - - ret = 0; + return -1; - cleanup: - virCPUDataFree(cpu); - virCPUDataFree(disabled); - return ret; + return 0; } -- 2.34.1