From e170af3ac03776128f6f15976ff7531a6ab17b71 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 31 Jul 2009 16:55:49 +0100 Subject: [PATCH] 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 --- src/qemu_driver.c | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.47.2