mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
virStorageAdapterParseXML: Use g_autofree
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
b127e50290
commit
8e2d030e26
@ -168,9 +168,8 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
|
|||||||
xmlNodePtr node,
|
xmlNodePtr node,
|
||||||
xmlXPathContextPtr ctxt)
|
xmlXPathContextPtr ctxt)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
char *adapter_type = NULL;
|
g_autofree char *adapter_type = NULL;
|
||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
@ -180,27 +179,23 @@ virStorageAdapterParseXML(virStorageAdapter *adapter,
|
|||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Unknown pool adapter type '%s'"),
|
_("Unknown pool adapter type '%s'"),
|
||||||
adapter_type);
|
adapter_type);
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST) &&
|
if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_FC_HOST) &&
|
||||||
(virStorageAdapterParseXMLFCHost(node, &adapter->data.fchost)) < 0)
|
(virStorageAdapterParseXMLFCHost(node, &adapter->data.fchost)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
|
|
||||||
if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) &&
|
if ((adapter->type == VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) &&
|
||||||
(virStorageAdapterParseXMLSCSIHost(node, ctxt,
|
(virStorageAdapterParseXMLSCSIHost(node, ctxt,
|
||||||
&adapter->data.scsi_host)) < 0)
|
&adapter->data.scsi_host)) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
} else {
|
} else {
|
||||||
if (virStorageAdapterParseXMLLegacy(node, ctxt, adapter) < 0)
|
if (virStorageAdapterParseXMLLegacy(node, ctxt, adapter) < 0)
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
VIR_FREE(adapter_type);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user