diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0d77d572a49e1c86f86911bce54d93fdb4a38feb..9ff712cae6b6da2b7405c5e895aa6219dbe80f34 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7434,7 +7434,12 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn, } /* Target domain name, maybe renamed. */ - dname = dname ? dname : def->name; + if (dname) { + VIR_FREE(def->name); + def->name = strdup(dname); + if (def->name == NULL) + goto cleanup; + } if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0) goto cleanup; @@ -7660,7 +7665,12 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn, } /* Target domain name, maybe renamed. */ - dname = dname ? dname : def->name; + if (dname) { + VIR_FREE(def->name); + def->name = strdup(dname); + if (def->name == NULL) + goto cleanup; + } if (virDomainObjIsDuplicate(&driver->domains, def, 1) < 0) goto cleanup;