From 635be49d81723cda62acca7f4c233836493048bd Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Thu, 18 Aug 2022 13:24:53 -0400 Subject: [PATCH] esx: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Laine Stump Reviewed-by: Ján Tomko --- src/esx/esx_network_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c index 290c0ad56f..bf9630ce9d 100644 --- a/src/esx/esx_network_driver.c +++ b/src/esx/esx_network_driver.c @@ -277,7 +277,7 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml, { virNetworkPtr network = NULL; esxPrivate *priv = conn->privateData; - virNetworkDef *def = NULL; + g_autoptr(virNetworkDef) def = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostPortGroup *hostPortGroupList = NULL; esxVI_HostPortGroup *hostPortGroup = NULL; @@ -483,7 +483,6 @@ esxNetworkDefineXMLFlags(virConnectPtr conn, const char *xml, network = virGetNetwork(conn, hostVirtualSwitch->name, md5); cleanup: - virNetworkDefFree(def); esxVI_HostVirtualSwitch_Free(&hostVirtualSwitch); esxVI_HostPortGroup_Free(&hostPortGroupList); esxVI_HostVirtualSwitchSpec_Free(&hostVirtualSwitchSpec); @@ -658,7 +657,7 @@ esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags) esxVI_String *networkNameList = NULL; esxVI_String *hostPortGroupKey = NULL; esxVI_String *networkName = NULL; - virNetworkDef *def; + g_autoptr(virNetworkDef) def = NULL; if (esxVI_EnsureSession(priv->primary) < 0) return NULL; @@ -812,7 +811,6 @@ esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags) esxVI_String_Free(&propertyNameList); esxVI_ObjectContent_Free(&networkList); esxVI_String_Free(&networkNameList); - virNetworkDefFree(def); return xml; }