Since this function is now only called when an 'acceleration' element is present in the xml, any failure to parse the element will be considered an error. Previously, we detected some types of errors, but we would only log an error (virReportError()), but still return a partially-specified accel object to the caller. This patch returns NULL for all parsing errors and reports that error back up to the caller. Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> --- src/conf/domain_conf.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b0599c7318..c0f20c928f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15269,8 +15269,11 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) accel2d = virXMLPropString(node, "accel2d"); rendernode = virXMLPropString(node, "rendernode"); - if (!accel3d && !accel2d && !rendernode) + if (!accel3d && !accel2d && !rendernode) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("missing values for acceleration")); return NULL; + } def = g_new0(virDomainVideoAccelDef, 1); @@ -15278,7 +15281,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if ((val = virTristateBoolTypeFromString(accel3d)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel3d value '%s'"), accel3d); - goto cleanup; + return NULL; } def->accel3d = val; } @@ -15287,7 +15290,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if ((val = virTristateBoolTypeFromString(accel2d)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown accel2d value '%s'"), accel2d); - goto cleanup; + return NULL; } def->accel2d = val; } @@ -15295,7 +15298,6 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if (rendernode) def->rendernode = virFileSanitizePath(rendernode); - cleanup: return g_steal_pointer(&def); } @@ -15414,8 +15416,10 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt, while (child != NULL) { if (child->type == XML_ELEMENT_NODE) { if (def->accel == NULL && - virXMLNodeNameEqual(child, "acceleration")) - def->accel = virDomainVideoAccelDefParseXML(child); + virXMLNodeNameEqual(child, "acceleration")) { + if ((def->accel = virDomainVideoAccelDefParseXML(child)) == NULL) + goto error; + } if (def->res == NULL && virXMLNodeNameEqual(child, "resolution")) { if ((def->res = virDomainVideoResolutionDefParseXML(child)) == NULL) -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list