From: Daniel P. Berrange Date: Fri, 31 Jul 2009 15:55:49 +0000 (+0100) Subject: Protected against potential crash scenarios X-Git-Tag: v0.7.0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e170af3ac03776128f6f15976ff7531a6ab17b71;p=thirdparty%2Flibvirt.git 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 --- diff --git a/src/qemu_driver.c b/src/qemu_driver.c index cebbafb969..e7a6b9b8e1 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -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)