]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Avoid fd leak on incoming tunneled migration
authorJiri Denemark <jdenemar@redhat.com>
Mon, 19 Jun 2017 15:00:28 +0000 (17:00 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 26 Jun 2017 08:36:57 +0000 (10:36 +0200)
While qemuProcessIncomingDefNew takes an fd argument and stores it in
qemuProcessIncomingDef structure, the caller is still responsible for
closing the file descriptor.

Introduced by commit v1.2.21-140-ge7c6f4575.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_migration.c
src/qemu/qemu_process.c

index 8129dcd406384356ffb4243f9fef13d4f3ac3fe0..c23fffef2a9cb9bf58e03f62c44eacd879e7ed45 100644 (file)
@@ -2690,7 +2690,6 @@ qemuMigrationPrepareAny(virQEMUDriverPtr driver,
                                                   listenAddress, port,
                                                   dataFD[0])))
         goto stopjob;
-    dataFD[0] = -1; /* the FD is now owned by incoming */
 
     if (qemuProcessPrepareDomain(dconn, driver, vm,
                                  VIR_QEMU_PROCESS_START_AUTODESTROY) < 0)
index f1447c33db76427461d3cdc40cae4a9ac480d688..d669dfb32dc6ae54a36b7f7723f8eedd6c6a67de 100644 (file)
@@ -4166,6 +4166,9 @@ qemuProcessIncomingDefFree(qemuProcessIncomingDefPtr inc)
  * This function does not copy @path, the caller is responsible for keeping
  * the @path pointer valid during the lifetime of the allocated
  * qemuProcessIncomingDef structure.
+ *
+ * The caller is responsible for closing @fd, calling
+ * qemuProcessIncomingDefFree will NOT close it.
  */
 qemuProcessIncomingDefPtr
 qemuProcessIncomingDefNew(virQEMUCapsPtr qemuCaps,