]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMigrationSrcToFile: Don't leak 'qemuFDPass' in cleanup path
authorPeter Krempa <pkrempa@redhat.com>
Tue, 2 Dec 2025 21:16:24 +0000 (22:16 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 10 Dec 2025 10:07:33 +0000 (11:07 +0100)
A temporary 'qemuFDPass' is used when cleaning up after a migration to a
file but it's not freed after use. Declare it as autoptr.

Fixes: c2518f7bc7d
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_migration.c

index 9059f9aa3a6cc0005aa4b32fb626288c68debf98..4f9b649b63efe3d9e6982ae5c90a8445144fc92a 100644 (file)
@@ -7325,11 +7325,13 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
     /* Remove fdset passed to qemu and restore max migration bandwidth */
     if (qemuDomainObjIsActive(vm)) {
         if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) == 0) {
-            qemuFDPass *fdPass =
-                qemuFDPassNewFromMonitor("libvirt-outgoing-migrate", priv->mon);
+            g_autoptr(qemuFDPass) fdPass = NULL;
+
+            fdPass = qemuFDPassNewFromMonitor("libvirt-outgoing-migrate", priv->mon);
 
             if (fdPass)
                 qemuFDPassTransferMonitorRollback(fdPass, priv->mon);
+
             qemuDomainObjExitMonitor(vm);
         }