Fix memory leak of monitor character device

* 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
This commit is contained in:
Daniel P. Berrange 2009-08-26 15:38:32 +01:00
parent 2a6825c393
commit e1424a97a9

View File

@ -2285,6 +2285,13 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
close(vm->monitor); close(vm->monitor);
vm->monitor = -1; 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 */ /* shut it off for sure */
virKillProcess(vm->pid, SIGKILL); virKillProcess(vm->pid, SIGKILL);