From 9ef6fee12909a70e52b37c3e5277e83d70cdf0da Mon Sep 17 00:00:00 2001 From: Shaleen Bathla Date: Thu, 11 Jan 2024 18:27:54 +0530 Subject: [PATCH] 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 --- src/conf/domain_conf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; } -- 2.47.2