]> xenbits.xensource.com Git - libvirt.git/commitdiff
virStorageAdapterParseXML: Use g_autofree
authorTim Wiederhake <twiederh@redhat.com>
Wed, 19 May 2021 14:10:09 +0000 (16:10 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 20 May 2021 09:52:38 +0000 (11:52 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/storage_adapter_conf.c

index 6b5a58e1e75e56a93882fb60e53a56ec247572a3..717d00dc4aea37950394341b144c449c8bae3019 100644 (file)
@@ -168,9 +168,8 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
                           xmlNodePtr node,
                           xmlXPathContextPtr ctxt)
 {
-    int ret = -1;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
-    char *adapter_type = NULL;
+    g_autofree char *adapter_type = NULL;
 
     ctxt->node = node;
 
@@ -180,27 +179,23 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Unknown pool adapter type '%s'"),
                            adapter_type);
-            goto cleanup;
+            return -1;
         }
 
         if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST) &&
             (virStorageAdapterParseXMLFCHost(node, &adapter->data.fchost)) < 0)
-                goto cleanup;
+            return -1;
 
         if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) &&
             (virStorageAdapterParseXMLSCSIHost(node, ctxt,
                                                &adapter->data.scsi_host)) < 0)
-                goto cleanup;
+            return -1;
     } else {
         if (virStorageAdapterParseXMLLegacy(node, ctxt, adapter) < 0)
-            goto cleanup;
+            return -1;
     }
 
-    ret = 0;
-
- cleanup:
-    VIR_FREE(adapter_type);
-    return ret;
+    return 0;
 }