Protected against potential crash scenarios

* src/qemu_driver.c: Check that monitor device is not NULL
  before runing a command to protect against bugs in caller
This commit is contained in:
Daniel P. Berrange 2009-07-31 16:55:49 +01:00
parent 88e3e8be7c
commit e170af3ac0

View 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)