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
This commit is contained in:
Mark McLoughlin
2009-09-17 16:05:03 +01:00
parent 3c80fac258
commit 8881ae1bf8
+2 -2
View 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);