]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Protected against potential crash scenarios
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 31 Jul 2009 15:55:49 +0000 (16:55 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 31 Jul 2009 16:06:44 +0000 (17:06 +0100)
* src/qemu_driver.c: Check that monitor device is not NULL
  before runing a command to protect against bugs in caller

src/qemu_driver.c

index cebbafb969b1fbb5b06c9a80cb5230ef599180aa..e7a6b9b8e14b80b3afabf25b1aba56fae946647b 100644 (file)
@@ -2299,6 +2299,11 @@ qemudMonitorCommandExtra(const virDomainObjPtr vm,
     int size = 0;
     char *buf = NULL;
 
+    /* Should never happen, but just in case, protect
+     * against null monitor (ocurrs when VM is inactive) */
+    if (!vm->monitor_chr)
+        return -1;
+
     qemuMonitorDiscardPendingData(vm);
 
     if (qemudMonitorSend(vm, cmd, scm_fd) < 0)