domain_conf.c: use g_autofree in 'dev' in virDomainDefParseBootXML()

This spares us of 2 explicit VIR_FREE() calls.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2020-11-16 17:34:00 -03:00
parent bac69aa1f9
commit 340db6e549

View File

@ -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;
}