mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 15:52:55 +00:00
cpu_x86: Use g_auto* in x86ModelParse
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
93f173adbe
commit
b239a60967
@ -1493,41 +1493,36 @@ x86ModelParse(xmlXPathContextPtr ctxt,
|
|||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
virCPUx86MapPtr map = data;
|
virCPUx86MapPtr map = data;
|
||||||
virCPUx86ModelPtr model = NULL;
|
g_autoptr(virCPUx86Model) model = NULL;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (x86ModelFind(map, name)) {
|
if (x86ModelFind(map, name)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Multiple definitions of CPU model '%s'"), name);
|
_("Multiple definitions of CPU model '%s'"), name);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
model = g_new0(virCPUx86Model, 1);
|
model = g_new0(virCPUx86Model, 1);
|
||||||
model->name = g_strdup(name);
|
model->name = g_strdup(name);
|
||||||
|
|
||||||
if (x86ModelParseDecode(model, ctxt) < 0)
|
if (x86ModelParseDecode(model, ctxt) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
if (x86ModelParseAncestor(model, ctxt, map) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (x86ModelParseSignatures(model, ctxt) < 0)
|
if (x86ModelParseSignatures(model, ctxt) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (x86ModelParseVendor(model, ctxt, map) < 0)
|
if (x86ModelParseVendor(model, ctxt, map) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (x86ModelParseFeatures(model, ctxt, map) < 0)
|
if (x86ModelParseFeatures(model, ctxt, map) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
if (VIR_APPEND_ELEMENT(map->models, map->nmodels, model) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
x86ModelFree(model);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user