From: Kirill Shchetiniuk <[email protected]>
Signed-off-by: Kirill Shchetiniuk <[email protected]>
---
src/conf/domain_conf.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 0b36a71dba..d41dd4a829 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9187,7 +9187,7 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
size_t num)
{
size_t i;
- virDomainIdMapEntry *idmap = NULL;
+ g_autofree virDomainIdMapEntry *idmap = NULL;
VIR_XPATH_NODE_AUTORESTORE(ctxt)
idmap = g_new0(virDomainIdMapEntry, num);
@@ -9199,14 +9199,13 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
virXPathUInt("string(./@count)", ctxt, &idmap[i].count) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("invalid idmap start/target/count settings"));
- VIR_FREE(idmap);
return NULL;
}
}
g_qsort_with_data(idmap, num, sizeof(idmap[0]), virDomainIdMapEntrySort,
NULL);
- return idmap;
+ return g_steal_pointer(&idmap);
}
--
2.49.0