From: Daniel Henrique Barboza Date: Wed, 2 Sep 2020 20:25:44 +0000 (-0300) Subject: cpu_ppc64.c: use g_autoptr() in virCPUppc64GetHost() X-Git-Tag: v6.8.0-rc1~240 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec79c3338bdb2ff1c3386275914805d5a2679c66;p=thirdparty%2Flibvirt.git 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 Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index b7c4864200..bc9d399939 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -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); }