qemu: Avoid fd leak on incoming tunneled migration

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>
This commit is contained in:
Jiri Denemark 2017-06-19 17:00:28 +02:00
parent f454464ddd
commit 2abb0e4bb2
2 changed files with 3 additions and 1 deletions

View 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)

View 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,