提交 1cd8f500 编写于 作者: J Ján Tomko

Fix segfault when starting a domain with no cpu definition

My commit fba6bc47 iterated over the features in cpu definition
without checking if there is one.
上级 d9504941
......@@ -1513,7 +1513,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver, virDomainObjPtr vm,
return false;
}
for (i = 0; i < def->cpu->nfeatures; i++) {
for (i = 0; def->cpu && i < def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &def->cpu->features[i];
if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
......
......@@ -3636,7 +3636,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm)
}
}
for (i = 0; i < def->cpu->nfeatures; i++) {
for (i = 0; def->cpu && i < def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &def->cpu->features[i];
if (feature->policy != VIR_CPU_FEATURE_REQUIRE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册