Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ef1a9cdab2..4debb895e9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15442,7 +15442,7 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf, { int event; g_autofree char *name = NULL; - g_autofree char *enabled = NULL; + virTristateBool enabled = VIR_TRISTATE_BOOL_ABSENT; if (!(name = virXMLPropString(node, "name"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing perf event name")); @@ -15461,18 +15461,9 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf, return -1; } - if (!(enabled = virXMLPropString(node, "enabled"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing state of perf event '%s'"), name); - return -1; - } - - if ((perf->events[event] = virTristateBoolTypeFromString(enabled)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid state '%s' of perf event '%s'"), - enabled, name); + if (virXMLPropTristateBool(node, "enabled", true, &enabled) < 0) return -1; - } + perf->events[event] = enabled; return 0; } -- 2.26.2