[libvirt] [PATCH] qemu: fix use a nonexist address in qemuDomainAttachDeviceConfig

Luyao Huang lhuang at redhat.com
Mon Dec 15 09:10:45 UTC 2014


We free them before, then use it. This make we always do
virDomainDefAddImplicitControllers when attach a disk.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index df3ba6d..a9afa5d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7223,10 +7223,10 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
         if (virDomainDiskInsert(vmdef, disk))
             return -1;
         /* vmdef has the pointer. Generic codes for vmdef will do all jobs */
-        dev->data.disk = NULL;
         if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO)
             if (virDomainDefAddImplicitControllers(vmdef) < 0)
                 return -1;
+        dev->data.disk = NULL;
         if (qemuDomainAssignAddresses(vmdef, qemuCaps, NULL) < 0)
             return -1;
         break;
-- 
1.8.3.1




More information about the libvir-list mailing list