virCPUx86MapPtr map,
int policy)
{
- virCPUx86ModelPtr model = NULL;
+ g_autoptr(virCPUx86Model) model = NULL;
size_t i;
/* host CPU only contains required features; requesting other features
if (!(feature = x86FeatureFind(map, cpu->features[i].name))) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU feature %s"), cpu->features[i].name);
- goto error;
+ return NULL;
}
if (policy == -1) {
case VIR_CPU_FEATURE_FORCE:
case VIR_CPU_FEATURE_REQUIRE:
if (x86DataAdd(&model->data, &feature->data) < 0)
- goto error;
+ return NULL;
break;
case VIR_CPU_FEATURE_DISABLE:
break;
}
} else if (x86DataAdd(&model->data, &feature->data) < 0) {
- goto error;
+ return NULL;
}
}
- return model;
-
- error:
- x86ModelFree(model);
- return NULL;
+ return g_steal_pointer(&model);
}