* src/qemu/qemu_domain.c (qemuDomainObjExitAgentInternal): fix crashing
libvirtd due to derefing a NULL pointer.
For details, please see bug:
RHBZ:
https://bugzilla.redhat.com/show_bug.cgi?id=845966
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
src/qemu/qemu_domain.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 86f0265..8667b6c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1136,12 +1136,14 @@ qemuDomainObjExitAgentInternal(struct qemud_driver *driver,
virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
- int refs;
+ int refs = -1;
- refs = qemuAgentUnref(priv->agent);
+ if (priv->agent) {
+ refs = qemuAgentUnref(priv->agent);
- if (refs > 0)
- qemuAgentUnlock(priv->agent);
+ if (refs > 0)
+ qemuAgentUnlock(priv->agent);
+ }
if (driver_locked)
qemuDriverLock(driver);
--
1.7.1