From: Shaleen Bathla Date: Thu, 11 Jan 2024 12:57:54 +0000 (+0530) Subject: conf: domain_conf: cleanup def in case of errors X-Git-Tag: v10.0.0-rc2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ef6fee12909a70e52b37c3e5277e83d70cdf0da;p=thirdparty%2Flibvirt.git conf: domain_conf: cleanup def in case of errors Just like in rest of the function virDomainFSDefParseXML, use goto error so that def will be cleaned up in error cases. Signed-off-by: Shaleen Bathla Reviewed-by: Jonathon Jongsma --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index be57a1981e..5d55d2acda 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8866,23 +8866,23 @@ virDomainFSDefParseXML(virDomainXMLOption *xmlopt, goto error; if ((n = virXPathNodeSet("./idmap/uid", ctxt, &uid_nodes)) < 0) - return NULL; + goto error; if (n) { def->idmap.uidmap = virDomainIdmapDefParseXML(ctxt, uid_nodes, n); if (!def->idmap.uidmap) - return NULL; + goto error; def->idmap.nuidmap = n; } if ((n = virXPathNodeSet("./idmap/gid", ctxt, &gid_nodes)) < 0) - return NULL; + goto error; if (n) { def->idmap.gidmap = virDomainIdmapDefParseXML(ctxt, gid_nodes, n); if (!def->idmap.gidmap) - return NULL; + goto error; def->idmap.ngidmap = n; }