]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
conf: domain_conf: cleanup def in case of errors
authorShaleen Bathla <shaleen.bathla@oracle.com>
Thu, 11 Jan 2024 12:57:54 +0000 (18:27 +0530)
committerJonathon Jongsma <jjongsma@redhat.com>
Thu, 11 Jan 2024 22:53:31 +0000 (16:53 -0600)
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 <shaleen.bathla@oracle.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
src/conf/domain_conf.c

index be57a1981e7da6b469923291f881cae786b5a640..5d55d2acdace5cd8a49b4e44ff5f8e2dab059bd5 100644 (file)
@@ -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;
         }