[libvirt PATCH 07/16] tests: replace explicit virNetworkDefFree() with g_autoptr(virNetworkDef)

Laine Stump laine at redhat.com
Mon Aug 22 13:31:41 UTC 2022


Signed-off-by: Laine Stump <laine at redhat.com>
---
 tests/networkxml2firewalltest.c  | 3 +--
 tests/networkxml2xmltest.c       | 3 +--
 tests/networkxml2xmlupdatetest.c | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c
index 2648115a12..f895ca8c56 100644
--- a/tests/networkxml2firewalltest.c
+++ b/tests/networkxml2firewalltest.c
@@ -89,7 +89,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
 {
     g_autofree char *actualargv = NULL;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
-    virNetworkDef *def = NULL;
+    g_autoptr(virNetworkDef) def = NULL;
     int ret = -1;
     char *actual;
     g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew();
@@ -117,7 +117,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
     ret = 0;
 
  cleanup:
-    virNetworkDefFree(def);
     return ret;
 }
 
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 5f39162ef1..521f058acc 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -27,7 +27,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     g_autofree char *actual = NULL;
     int ret;
     testCompareNetXML2XMLResult result = TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS;
-    virNetworkDef *dev = NULL;
+    g_autoptr(virNetworkDef) dev = NULL;
     g_autoptr(virNetworkXMLOption) xmlopt = NULL;
 
     if (!(xmlopt = networkDnsmasqCreateXMLConf()))
@@ -68,7 +68,6 @@ testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
     }
     virResetLastError();
 
-    virNetworkDefFree(dev);
     return ret;
 }
 
diff --git a/tests/networkxml2xmlupdatetest.c b/tests/networkxml2xmlupdatetest.c
index c50c6c8558..4926609f90 100644
--- a/tests/networkxml2xmlupdatetest.c
+++ b/tests/networkxml2xmlupdatetest.c
@@ -20,7 +20,7 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
     g_autofree char *updateXmlData = NULL;
     g_autofree char *actual = NULL;
     int ret = -1;
-    virNetworkDef *def = NULL;
+    g_autoptr(virNetworkDef) def = NULL;
 
     if (virTestLoadFile(updatexml, &updateXmlData) < 0)
         goto error;
@@ -53,7 +53,6 @@ testCompareXMLToXMLFiles(const char *netxml, const char *updatexml,
         }
     }
  error:
-    virNetworkDefFree(def);
     return ret;
 }
 
-- 
2.37.1



More information about the libvir-list mailing list