[libvirt] [PATCH 3/3] Fix memory leak of monitor character device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* src/qemu_driver.c: Free the vm->monitor_chr field at VM shutdown.
  Unlink the UNIX domain socket at VM shutdown to avoid littering
  FS with old sockets
---
 src/qemu_driver.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 0342627..b30971c 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2239,6 +2239,13 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
         close(vm->monitor);
     vm->monitor = -1;
 
+    if (vm->monitor_chr) {
+        if (vm->monitor_chr->type == VIR_DOMAIN_CHR_TYPE_UNIX)
+            unlink(vm->monitor_chr->data.nix.path);
+        virDomainChrDefFree(vm->monitor_chr);
+        vm->monitor_chr = NULL;
+    }
+
     /* shut it off for sure */
     virKillProcess(vm->pid, SIGKILL);
 
-- 
1.6.2.5

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]