]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix possible NULL pointer dereference
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 14 Dec 2009 13:09:10 +0000 (14:09 +0100)
committerDaniel Veillard <veillard@redhat.com>
Mon, 14 Dec 2009 13:09:10 +0000 (14:09 +0100)
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.

src/qemu/qemu_driver.c

index 3946c27665692d715e50fa52b14cde2fb3847335..faeb8385cd51e661e7ad8d45978b1a38c033ce5a 100644 (file)
@@ -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;