[PATCH v1 03/10] qemu_driver.c: use g_autoptr() with virDomainDeviceDefPtr

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

 



Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/qemu/qemu_driver.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2198e7f1e9..6ff7289fd1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7748,9 +7748,9 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     g_autoptr(virDomainDef) vmdef = NULL;
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
-    virDomainDeviceDefPtr devConf = NULL;
+    g_autoptr(virDomainDeviceDef) devConf = NULL;
     virDomainDeviceDef devConfSave = { 0 };
-    virDomainDeviceDefPtr devLive = NULL;
+    g_autoptr(virDomainDeviceDef) devLive = NULL;
     int ret = -1;
     unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_INACTIVE |
                                VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
@@ -7836,9 +7836,6 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
 
     ret = 0;
  cleanup:
-    virDomainDeviceDefFree(devConf);
-    virDomainDeviceDefFree(devLive);
-
     return ret;
 }
 
@@ -7894,7 +7891,8 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
     virDomainObjPtr vm = NULL;
     qemuDomainObjPrivatePtr priv;
     g_autoptr(virDomainDef) vmdef = NULL;
-    virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
+    g_autoptr(virDomainDeviceDef) dev = NULL;
+    virDomainDeviceDefPtr dev_copy = NULL;
     bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
     int ret = -1;
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
@@ -7990,7 +7988,6 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
  cleanup:
     if (dev != dev_copy)
         virDomainDeviceDefFree(dev_copy);
-    virDomainDeviceDefFree(dev);
     virDomainObjEndAPI(&vm);
     virNWFilterUnlockFilterUpdates();
     return ret;
@@ -8004,7 +8001,8 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
 {
     qemuDomainObjPrivatePtr priv = vm->privateData;
     g_autoptr(virQEMUDriverConfig) cfg = NULL;
-    virDomainDeviceDefPtr dev = NULL, dev_copy = NULL;
+    g_autoptr(virDomainDeviceDef) dev = NULL;
+    virDomainDeviceDefPtr dev_copy = NULL;
     unsigned int parse_flags = VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE;
     g_autoptr(virDomainDef) vmdef = NULL;
     int ret = -1;
@@ -8080,7 +8078,6 @@ qemuDomainDetachDeviceLiveAndConfig(virQEMUDriverPtr driver,
  cleanup:
     if (dev != dev_copy)
         virDomainDeviceDefFree(dev_copy);
-    virDomainDeviceDefFree(dev);
     return ret;
 }
 
-- 
2.26.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