When detected invalid 'memAccess', virCPUDefParseXML should report error. Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1146334 Signed-off-by: Jincheng Miao <jmiao@xxxxxxxxxx> --- src/conf/cpu_conf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 116aa58..9b7fbb0 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -507,17 +507,19 @@ virCPUDefParseXML(xmlNodePtr node, memAccessStr = virXMLPropString(nodes[i], "memAccess"); if (memAccessStr) { - def->cells[cur_cell].memAccess = - virMemAccessTypeFromString(memAccessStr); + int rc = virMemAccessTypeFromString(memAccessStr); - if (def->cells[cur_cell].memAccess <= 0) { + if (rc <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid 'memAccess' attribute " "value '%s'"), memAccessStr); VIR_FREE(memAccessStr); - goto cleanup; + goto error; } + + def->cells[cur_cell].memAccess = rc; + VIR_FREE(memAccessStr); } } -- 1.9.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list