]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix memory leak of monitor character device
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 26 Aug 2009 14:38:32 +0000 (15:38 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 3 Sep 2009 17:10:16 +0000 (18:10 +0100)
* 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

index d424ce7bb098023e981c83b0a91038276db5461d..2a8e6d161395a16fd605ef8987bf954a6359f687 100644 (file)
@@ -2285,6 +2285,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);