]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainIOThreadIDDefParseXML: Refactor cleanup
authorPeter Krempa <pkrempa@redhat.com>
Thu, 6 May 2021 12:15:31 +0000 (14:15 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 7 May 2021 08:06:18 +0000 (10:06 +0200)
Automatically free 'iothrid' and remove all the cleanup cruft.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c

index baf5d316066a67cb1ce7443fa1c791e95f8f4b18..78775bb2b34119fdfa4cbde5d0b102f2e48bd05d 100644 (file)
@@ -17010,21 +17010,14 @@ virDomainIdmapDefParseXML(xmlXPathContextPtr ctxt,
 static virDomainIOThreadIDDef *
 virDomainIOThreadIDDefParseXML(xmlNodePtr node)
 {
-    virDomainIOThreadIDDef *iothrid;
-
-    iothrid = g_new0(virDomainIOThreadIDDef, 1);
+    g_autoptr(virDomainIOThreadIDDef) iothrid = g_new0(virDomainIOThreadIDDef, 1);
 
     if (virXMLPropUInt(node, "id", 10,
                        VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
                        &iothrid->iothread_id) < 0)
-        goto error;
-
-    return iothrid;
+        return NULL;
 
- error:
-    virDomainIOThreadIDDefFree(iothrid);
-    iothrid = NULL;
-    return iothrid;
+    return g_steal_pointer(&iothrid);
 }