esx: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef)

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2022-08-18 13:24:53 -04:00
parent f172de14fe
commit 635be49d81

View File

@ -277,7 +277,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
{ {
virNetworkPtr network = NULL; virNetworkPtr network = NULL;
esxPrivate *priv = conn->privateData; esxPrivate *priv = conn->privateData;
virNetworkDef *def = NULL; g_autoptr(virNetworkDef) def = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
esxVI_HostPortGroup *hostPortGroupList = NULL; esxVI_HostPortGroup *hostPortGroupList = NULL;
esxVI_HostPortGroup *hostPortGroup = NULL; esxVI_HostPortGroup *hostPortGroup = NULL;
@ -483,7 +483,6 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml,
network = virGetNetwork(conn, hostVirtualSwitch->name, md5); network = virGetNetwork(conn, hostVirtualSwitch->name, md5);
cleanup: cleanup:
virNetworkDefFree(def);
esxVI_HostVirtualSwitch_Free(&hostVirtualSwitch); esxVI_HostVirtualSwitch_Free(&hostVirtualSwitch);
esxVI_HostPortGroup_Free(&hostPortGroupList); esxVI_HostPortGroup_Free(&hostPortGroupList);
esxVI_HostVirtualSwitchSpec_Free(&hostVirtualSwitchSpec); esxVI_HostVirtualSwitchSpec_Free(&hostVirtualSwitchSpec);
@ -658,7 +657,7 @@ esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags)
esxVI_String *networkNameList = NULL; esxVI_String *networkNameList = NULL;
esxVI_String *hostPortGroupKey = NULL; esxVI_String *hostPortGroupKey = NULL;
esxVI_String *networkName = NULL; esxVI_String *networkName = NULL;
virNetworkDef *def; g_autoptr(virNetworkDef) def = NULL;
if (esxVI_EnsureSession(priv->primary) < 0) if (esxVI_EnsureSession(priv->primary) < 0)
return NULL; return NULL;
@ -812,7 +811,6 @@ esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags)
esxVI_String_Free(&propertyNameList); esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&networkList); esxVI_ObjectContent_Free(&networkList);
esxVI_String_Free(&networkNameList); esxVI_String_Free(&networkNameList);
virNetworkDefFree(def);
return xml; return xml;
} }