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>
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;