qemu: Fix possible NULL deref in qemuDomainSaveImageStartVM

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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
John Ferlan 2019-11-03 07:35:25 -05:00
parent a6ce760f6b
commit 11e8d37c4b

View File

@ -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,