From: Peter Krempa <[email protected]> The contents of the object we're parsing are freed so no need to have intermediate variables.
Signed-off-by: Peter Krempa <[email protected]> --- src/conf/domain_conf.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 262aeca26c..a9ee5b47d8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7366,22 +7366,19 @@ virDomainLeaseDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt) { virDomainLeaseDef *def; - g_autofree char *lockspace = NULL; - g_autofree char *key = NULL; - g_autofree char *path = NULL; xmlNodePtr targetNode = NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) ctxt->node = node; def = g_new0(virDomainLeaseDef, 1); - if (!(key = virXPathString("string(./key)", ctxt))) { + if (!(def->key = virXPathString("string(./key)", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'key' element for lease")); goto error; } - if (!(lockspace = virXPathString("string(./lockspace)", ctxt))) { + if (!(def->lockspace = virXPathString("string(./lockspace)", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'lockspace' element for lease")); goto error; @@ -7393,7 +7390,7 @@ virDomainLeaseDefParseXML(xmlNodePtr node, goto error; } - if (!(path = virXMLPropString(targetNode, "path"))) { + if (!(def->path = virXMLPropString(targetNode, "path"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Missing 'path' attribute to 'target' element for lease")); goto error; @@ -7403,10 +7400,6 @@ virDomainLeaseDefParseXML(xmlNodePtr node, VIR_XML_PROP_NONE, &def->offset) < 0) goto error; - def->key = g_steal_pointer(&key); - def->lockspace = g_steal_pointer(&lockspace); - def->path = g_steal_pointer(&path); - return def; error: -- 2.54.0
