From: Mark McLoughlin Date: Thu, 17 Sep 2009 14:31:08 +0000 (+0100) Subject: Fix net/disk hot-unplug segfault X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=8881ae1bf8783006777429403cc543c33187175d;p=libvirt.git Fix net/disk hot-unplug segfault 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 --- diff --git a/src/qemu_driver.c b/src/qemu_driver.c index a65334fa1a..de31581322 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -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);