From 2c739866df5a820b2db280b36cd8b6fe00cfba58 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 3 Oct 2016 13:11:47 +0200 Subject: [PATCH] qemu: attach: Close monitor socket on connection failure If attaching to a qemu process fails after opening the monitor socket libvirt does not clean up the monitor. As the monitor also holds a reference to the domain object the qemu attach API basically leaks it. QEMU also does not interact on a second monitor connection and thus a further attempt to attach to it would lock up. Prevent libvirt from leaking the monitor by explicitly closing it. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1378401 --- src/qemu/qemu_process.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 31c8453173..a4bc082d79 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6386,6 +6386,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED, if (active && virAtomicIntDecAndTest(&driver->nactive) && driver->inhibitCallback) driver->inhibitCallback(false, driver->inhibitOpaque); + + qemuMonitorClose(priv->mon); + priv->mon = NULL; qemuDomainLogContextFree(logCtxt); VIR_FREE(seclabel); VIR_FREE(sec_managers); -- 2.47.2