cpu: Replace VIR_FREE with g_free

Note the use of g_clear_pointer(..., g_free) in ppc64DataClear and virCPUx86Baseline.

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Tim Wiederhake 2020-09-11 15:22:49 +02:00 committed by Ján Tomko
parent eb67d83100
commit 603b97cb32
3 changed files with 14 additions and 14 deletions

View File

@ -315,7 +315,7 @@ virCPUDataFree(virCPUDataPtr data)
if ((driver = cpuGetSubDriver(data->arch)) && driver->dataFree)
driver->dataFree(data);
else
VIR_FREE(data);
g_free(data);
}

View File

@ -126,7 +126,7 @@ ppc64DataClear(virCPUppc64Data *data)
if (!data)
return;
VIR_FREE(data->pvr);
g_clear_pointer(&data->pvr, g_free);
}
static int
@ -151,8 +151,8 @@ ppc64VendorFree(virCPUppc64VendorPtr vendor)
if (!vendor)
return;
VIR_FREE(vendor->name);
VIR_FREE(vendor);
g_free(vendor->name);
g_free(vendor);
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Vendor, ppc64VendorFree);
@ -177,8 +177,8 @@ ppc64ModelFree(virCPUppc64ModelPtr model)
return;
ppc64DataClear(&model->data);
VIR_FREE(model->name);
VIR_FREE(model);
g_free(model->name);
g_free(model);
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Model, ppc64ModelFree);
@ -261,13 +261,13 @@ ppc64MapFree(virCPUppc64MapPtr map)
for (i = 0; i < map->nmodels; i++)
ppc64ModelFree(map->models[i]);
VIR_FREE(map->models);
g_free(map->models);
for (i = 0; i < map->nvendors; i++)
ppc64VendorFree(map->vendors[i]);
VIR_FREE(map->vendors);
g_free(map->vendors);
VIR_FREE(map);
g_free(map);
}
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Map, ppc64MapFree);
@ -584,7 +584,7 @@ virCPUppc64DataFree(virCPUDataPtr data)
return;
ppc64DataClear(&data->data.ppc64);
VIR_FREE(data);
g_free(data);
}

View File

@ -493,7 +493,7 @@ virCPUx86DataFree(virCPUDataPtr data)
return;
virCPUx86DataClear(&data->data.x86);
VIR_FREE(data);
g_free(data);
}
@ -2207,7 +2207,7 @@ x86Decode(virCPUDefPtr cpu,
if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
i++;
} else {
VIR_FREE(cpuModel->features[i].name);
g_free(cpuModel->features[i].name);
VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i,
cpuModel->nfeatures);
}
@ -2892,7 +2892,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus,
cpu->fallback = VIR_CPU_FALLBACK_FORBID;
if (!outputVendor)
VIR_FREE(cpu->vendor);
g_clear_pointer(&cpu->vendor, g_free);
return g_steal_pointer(&cpu);
}
@ -2914,7 +2914,7 @@ x86UpdateHostModel(virCPUDefPtr guest,
return -1;
if (guest->vendor_id) {
VIR_FREE(updated->vendor_id);
g_free(updated->vendor_id);
updated->vendor_id = g_strdup(guest->vendor_id);
}