[PATCH v2 5/6] Use g_autoptr instead of virNetDevBandwidthFree where possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
---
 src/network/bridge_driver.c    | 3 +--
 src/qemu/qemu_driver.c         | 5 ++---
 src/test/test_driver.c         | 3 +--
 tests/virnetdevbandwidthtest.c | 3 +--
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 29060139d7..b29c37ef4c 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -5397,7 +5397,7 @@ networkPortSetParameters(virNetworkPortPtr port,
     virNetworkObjPtr obj;
     virNetworkDefPtr def;
     virNetworkPortDefPtr portdef;
-    virNetDevBandwidthPtr bandwidth = NULL;
+    g_autoptr(virNetDevBandwidth) bandwidth = NULL;
     g_autofree char *dir = NULL;
     int ret = -1;
     size_t i;
@@ -5473,7 +5473,6 @@ networkPortSetParameters(virNetworkPortPtr port,
 
     ret = 0;
  cleanup:
-    virNetDevBandwidthFree(bandwidth);
     virNetworkObjEndAPI(&obj);
     return ret;
 }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b18e46e383..2a191232a6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10207,7 +10207,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
     virDomainDefPtr persistentDef;
     int ret = -1;
     virDomainNetDefPtr net = NULL, persistentNet = NULL;
-    virNetDevBandwidthPtr bandwidth = NULL, newBandwidth = NULL;
+    g_autoptr(virNetDevBandwidth) bandwidth = NULL;
+    g_autoptr(virNetDevBandwidth) newBandwidth = NULL;
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
     bool inboundSpecified = false, outboundSpecified = false;
     int actualType;
@@ -10421,8 +10422,6 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
     qemuDomainObjEndJob(driver, vm);
 
  cleanup:
-    virNetDevBandwidthFree(bandwidth);
-    virNetDevBandwidthFree(newBandwidth);
     virDomainObjEndAPI(&vm);
     return ret;
 }
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index bca1297d1d..0ac03de127 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3446,7 +3446,7 @@ testDomainSetInterfaceParameters(virDomainPtr dom,
     virDomainObjPtr vm = NULL;
     virDomainDefPtr def;
     virDomainNetDefPtr net = NULL;
-    virNetDevBandwidthPtr bandwidth = NULL;
+    g_autoptr(virNetDevBandwidth) bandwidth = NULL;
     bool inboundSpecified = false;
     bool outboundSpecified = false;
     size_t i;
@@ -3536,7 +3536,6 @@ testDomainSetInterfaceParameters(virDomainPtr dom,
 
     ret = 0;
  cleanup:
-    virNetDevBandwidthFree(bandwidth);
     virDomainObjEndAPI(&vm);
     return ret;
 }
diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c
index 5cbdd6ffea..2e76af3d0c 100644
--- a/tests/virnetdevbandwidthtest.c
+++ b/tests/virnetdevbandwidthtest.c
@@ -69,7 +69,7 @@ testVirNetDevBandwidthSet(const void *data)
     int ret = -1;
     const struct testSetStruct *info = data;
     const char *iface = info->iface;
-    virNetDevBandwidthPtr band = NULL;
+    g_autoptr(virNetDevBandwidth) band = NULL;
     g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     char *actual_cmd = NULL;
 
@@ -98,7 +98,6 @@ testVirNetDevBandwidthSet(const void *data)
     ret = 0;
  cleanup:
     virCommandSetDryRun(NULL, NULL, NULL);
-    virNetDevBandwidthFree(band);
     VIR_FREE(actual_cmd);
     return ret;
 }
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux