]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix net/disk hot-unplug segfault
authorMark McLoughlin <markmc@redhat.com>
Thu, 17 Sep 2009 14:31:08 +0000 (15:31 +0100)
committerMark McLoughlin <markmc@redhat.com>
Thu, 17 Sep 2009 15:05:03 +0000 (16:05 +0100)
When we hot-unplug the last device, we're currently double-freeing
the device definition.

Reported by Martin Banas here:

  https://bugzilla.redhat.com/523953

* src/qemu_driver.c: fix double free

src/qemu_driver.c

index a65334fa1a013ad6b7e6f9008c39ae4e2f3707bd..de31581322172f07025d7ee9fe743d6b80f5e54c 100644 (file)
@@ -5998,7 +5998,7 @@ try_command:
             /* ignore, harmless */
         }
     } else {
-        VIR_FREE(vm->def->disks[0]);
+        VIR_FREE(vm->def->disks);
         vm->def->ndisks = 0;
     }
     virDomainDiskDefFree(detach);
@@ -6100,7 +6100,7 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
             /* ignore, harmless */
         }
     } else {
-        VIR_FREE(vm->def->nets[0]);
+        VIR_FREE(vm->def->nets);
         vm->def->nnets = 0;
     }
     virDomainNetDefFree(detach);