]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: attach: Close monitor socket on connection failure
authorPeter Krempa <pkrempa@redhat.com>
Mon, 3 Oct 2016 11:11:47 +0000 (13:11 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 5 Oct 2016 06:52:34 +0000 (08:52 +0200)
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

index 31c8453173200f33dfcfd660b763edd2fb39bead..a4bc082d796f9f768320d44bc23c2e59f0643c37 100644 (file)
@@ -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);