[PATCH 10/11] qemuhotplugtest: use g_autoptr(virDomainDeviceDef)

Michal Privoznik posted 11 patches 1 year, 7 months ago
[PATCH 10/11] qemuhotplugtest: use g_autoptr(virDomainDeviceDef)
Posted by Michal Privoznik 1 year, 7 months ago
This brings us one step closer to the caller of
qemuDomainAttachDeviceLive()
(qemuDomainAttachDeviceLiveAndConfig()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tests/qemuhotplugtest.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index d5ceb1373b..fffb4a3410 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -154,7 +154,7 @@ testQemuHotplug(const void *data)
     bool keep = test->keep;
     unsigned int device_parse_flags = 0;
     virDomainObj *vm = NULL;
-    virDomainDeviceDef *dev = NULL;
+    g_autoptr(virDomainDeviceDef) dev = NULL;
     g_autoptr(qemuMonitorTest) test_mon = NULL;
     qemuDomainObjPrivate *priv = NULL;
 
@@ -229,11 +229,6 @@ testQemuHotplug(const void *data)
     switch (test->action) {
     case ATTACH:
         ret = qemuDomainAttachDeviceLive(vm, dev, &driver);
-        if (ret == 0) {
-            /* vm->def stolen dev->data.* so we just need to free the dev
-             * envelope */
-            VIR_FREE(dev);
-        }
         if (ret == 0 || fail)
             ret = testQemuHotplugCheckResult(vm, result_xml,
                                              result_filename, fail);
@@ -262,7 +257,6 @@ testQemuHotplug(const void *data)
         virObjectUnref(vm);
         test->vm = NULL;
     }
-    virDomainDeviceDefFree(dev);
     return ((ret < 0 && fail) || (!ret && !fail)) ? 0 : -1;
 }
 
-- 
2.39.2
Re: [PATCH 10/11] qemuhotplugtest: use g_autoptr(virDomainDeviceDef)
Posted by Kristina Hanicova 1 year, 7 months ago
On Fri, Apr 21, 2023 at 10:25 AM Michal Privoznik <mprivozn@redhat.com>
wrote:

> This brings us one step closer to the caller of
> qemuDomainAttachDeviceLive()
> (qemuDomainAttachDeviceLiveAndConfig()).
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  tests/qemuhotplugtest.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
making impact,
Kristina