1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-25 10:03:49 +03:00

cpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost()

We don't need to call virCPUppc64DataFree() in a cleanup label.
This function is already assigned to the 'dataFree' interface
of cpuDriverPPC64, and it will be called by virCPUDataFree(), the
autocleanup function of virCPUDataPtr, via driver->dataFree.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Daniel Henrique Barboza 2020-09-02 17:25:44 -03:00 committed by Ján Tomko
parent 76d2c048c9
commit ec79c3338b

View File

@ -622,17 +622,16 @@ static int
virCPUppc64GetHost(virCPUDefPtr cpu,
virDomainCapsCPUModelsPtr models)
{
virCPUDataPtr cpuData = NULL;
g_autoptr(virCPUData) cpuData = NULL;
virCPUppc64Data *data;
int ret = -1;
if (!(cpuData = virCPUDataNew(archs[0])))
goto cleanup;
return -1;
data = &cpuData->data.ppc64;
if (VIR_ALLOC_N(data->pvr, 1) < 0)
goto cleanup;
return -1;
data->len = 1;
@ -642,11 +641,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu,
#endif
data->pvr[0].mask = 0xfffffffful;
ret = ppc64DriverDecode(cpu, cpuData, models);
cleanup:
virCPUppc64DataFree(cpuData);
return ret;
return ppc64DriverDecode(cpu, cpuData, models);
}