]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix data structure handling when controllers are attached
authorWolfgang Mauerer <wolfgang.mauerer@siemens.com>
Tue, 2 Mar 2010 08:24:59 +0000 (09:24 +0100)
committerDaniel Veillard <veillard@redhat.com>
Tue, 2 Mar 2010 08:24:59 +0000 (09:24 +0100)
* src/qemu/qemu_driver.c: in qemudDomainAttachDevice(), one must not
  delete the data part when the operation succeeds because it is
  required later on. The correct pattern to handlethe parsed
  representation of the device information on success
  is dev->data.controller = NULL; virDomainDeviceDefFree(dev);,
  which leaves the structure pointed at by data in memory.

src/qemu/qemu_driver.c

index 1586e358a90735ed2add002483b65e035883fef5..5394ff59d9d59528b1dd2ea0c9c456f02abffbda 100644 (file)
@@ -6111,6 +6111,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
             ret = qemudDomainAttachPciControllerDevice(driver, vm,
                                                        dev->data.controller, qemuCmdFlags);
+            if (ret == 0)
+                dev->data.controller = NULL;
         } else {
             qemuReportError(VIR_ERR_NO_SUPPORT,
                             _("disk controller bus '%s' cannot be hotplugged."),