[libvirt] [PATCH] Fix possible NULL pointer dereference

Paolo Bonzini pbonzini at redhat.com
Mon Dec 14 11:22:40 UTC 2009


If there are no references remaining to the object, vm is set to NULL
and vm->persistent cannot be accessed.  Fixed by this trivial patch.

* src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
NULL pointer dereference on --crash dump.
---
        >   Okay, I have pushed the 2 patches, I got a merge error in the
        > cleanup section of the QEmu dump entry point, which I manually
        > applied hope it's fine, I also had to cleanup some TAB used for
        > indentation (hint use "make syntax-check" to catch those),

        Here is a little adjustment.  Thanks!

 src/qemu/qemu_driver.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3946c27..faeb838 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3914,7 +3914,7 @@ endjob:
 
     if (qemuDomainObjEndJob(vm) == 0)
         vm = NULL;
-    if ((ret == 0) && (flags & VIR_DUMP_CRASH) && !vm->persistent) {
+    else if ((ret == 0) && (flags & VIR_DUMP_CRASH) && !vm->persistent) {
         virDomainRemoveInactive(&driver->domains,
                                 vm);
         vm = NULL;
-- 
1.6.5.2




More information about the libvir-list mailing list