cpu_x86: Make sure CPU model names are unique in cpu_map

Having multiple CPU model definitions with the same name could result in
unexpected behavior.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2019-02-26 08:33:08 +01:00
parent 8d249df9c9
commit 8d7245441a

View File

@ -1293,9 +1293,15 @@ x86ModelParse(xmlXPathContextPtr ctxt,
void *data)
{
virCPUx86MapPtr map = data;
virCPUx86ModelPtr model;
virCPUx86ModelPtr model = NULL;
int ret = -1;
if (x86ModelFind(map, name)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Multiple definitions of CPU model '%s'"), name);
goto cleanup;
}
if (!(model = x86ModelNew()))
goto cleanup;