From 2d72ad8dfbd8987379a58fd9b280cdaf4d191542 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Wed, 15 Apr 2020 11:14:35 +0800 Subject: qemu: add pointer check in qemuMonitorLastError We found a exception when libvirt occurrs segmentation fault. thread 1 is waiting object lock in qemuConnectMonitor, qemu process exits and sends EOF event as well, so thread 2 invokes qemuMonitorLastError but pointer mon is NULL. Signed-off-by: Feng Ni Signed-off-by: Xu Yandong --- src/qemu/qemu_monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a62fed8..cc62948 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -966,7 +966,7 @@ qemuMonitorSend(qemuMonitorPtr mon, virErrorPtr qemuMonitorLastError(qemuMonitorPtr mon) { - if (mon->lastError.code == VIR_ERR_OK) + if (!mon || mon->lastError.code == VIR_ERR_OK) return NULL; return virErrorCopyNew(&mon->lastError); -- 2.23.0