From 340db6e54940ab7bd9f56f99a4e53faf838016bd Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Mon, 16 Nov 2020 17:34:00 -0300 Subject: [PATCH] domain_conf.c: use g_autofree in 'dev' in virDomainDefParseBootXML() This spares us of 2 explicit VIR_FREE() calls. Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b1534dcc1e..4b80024f77 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18907,7 +18907,7 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, for (i = 0; i < n && i < VIR_DOMAIN_BOOT_LAST; i++) { int val; - char *dev = virXMLPropString(nodes[i], "dev"); + g_autofree char *dev = virXMLPropString(nodes[i], "dev"); if (!dev) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing boot device")); @@ -18917,10 +18917,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown boot device '%s'"), dev); - VIR_FREE(dev); return -1; } - VIR_FREE(dev); def->os.bootDevs[def->os.nBootDevs++] = val; }