]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuhotplugtest: use g_autoptr(virDomainDeviceDef)
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 20 Apr 2023 15:59:14 +0000 (17:59 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Apr 2023 06:46:27 +0000 (08:46 +0200)
This brings us one step closer to the caller of
qemuDomainAttachDeviceLive()
(qemuDomainAttachDeviceLiveAndConfig()).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Kristina Hanicova <khanicov@redhat.com>
tests/qemuhotplugtest.c

index 0794a0c9a43a7de290ad7b2cb0a231160743c08d..d571cd38dcf063a6f7219e96b29df97fc8ab3433 100644 (file)
@@ -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;
 }