提交 d93a08eb 编写于 作者: A Alex Jia 提交者: Eric Blake

qemu: avoid dereferencing a NULL pointer

* src/qemu/qemu_process.c: Taking if (qemuDomainObjEndJob(driver, obj) == 0)
  true branch then 'obj' is NULL, virDomainObjIsActive(obj) and
  virDomainObjUnref(obj) will dereference NULL pointer.
Signed-off-by: NAlex Jia <ajia@redhat.com>
上级 42b23434
...@@ -2661,22 +2661,24 @@ error: ...@@ -2661,22 +2661,24 @@ error:
if (qemuDomainObjEndJob(driver, obj) == 0) if (qemuDomainObjEndJob(driver, obj) == 0)
obj = NULL; obj = NULL;
if (!virDomainObjIsActive(obj)) { if (obj) {
if (virDomainObjUnref(obj) > 0) if (!virDomainObjIsActive(obj)) {
virDomainObjUnlock(obj); if (virDomainObjUnref(obj) > 0)
qemuDriverUnlock(driver); virDomainObjUnlock(obj);
return; qemuDriverUnlock(driver);
} return;
}
if (virDomainObjUnref(obj) > 0) { if (virDomainObjUnref(obj) > 0) {
/* We can't get the monitor back, so must kill the VM /* We can't get the monitor back, so must kill the VM
* to remove danger of it ending up running twice if * to remove danger of it ending up running twice if
* user tries to start it again later */ * user tries to start it again later */
qemuProcessStop(driver, obj, 0, VIR_DOMAIN_SHUTOFF_FAILED); qemuProcessStop(driver, obj, 0, VIR_DOMAIN_SHUTOFF_FAILED);
if (!obj->persistent) if (!obj->persistent)
virDomainRemoveInactive(&driver->domains, obj); virDomainRemoveInactive(&driver->domains, obj);
else else
virDomainObjUnlock(obj); virDomainObjUnlock(obj);
}
} }
qemuDriverUnlock(driver); qemuDriverUnlock(driver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册