Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx> --- src/conf/domain_conf.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a1aefdf0bf..c020bf9124 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15496,7 +15496,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")); @@ -15515,16 +15515,12 @@ virDomainPerfEventDefParseXML(virDomainPerfDefPtr perf, return -1; } - if (!(enabled = virXMLPropString(node, "enabled"))) { - virReportError(VIR_ERR_XML_ERROR, - _("missing state of perf event '%s'"), name); + if (virXMLPropYesNo(node, "enabled", &enabled) < 0) return -1; - } - if ((perf->events[event] = virTristateBoolTypeFromString(enabled)) < 0) { + if ((perf->events[event] = enabled) == VIR_TRISTATE_BOOL_ABSENT) { virReportError(VIR_ERR_XML_ERROR, - _("invalid state '%s' of perf event '%s'"), - enabled, name); + _("missing state of perf event '%s'"), name); return -1; } -- 2.26.2