[PATCH] qemu: Avoid libvirtd crash in qemuDomainObjExitAgentInternal

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]