[libvirt] [PATCH 6/8] qemu: Fix possible NULL deref in qemuDomainSaveImageStartVM

John Ferlan jferlan at redhat.com
Sun Nov 3 13:53:38 UTC 2019


Commit 075523438 added a direct reference to @cookie even though
it may be NULL as shown by a comment a few lines previous - so add
the check here as well.

Found by Coverity

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index d17c18705b..56fcba8b2c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6831,7 +6831,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
         qemuDomainFixupCPUs(vm, &cookie->cpu) < 0)
         goto cleanup;
 
-    if (!cookie->slirpHelper)
+    if (cookie && !cookie->slirpHelper)
         priv->disableSlirp = true;
 
     if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL,
-- 
2.20.1




More information about the libvir-list mailing list