mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: Resolve Coverity UNINIT
Coverity complained that 'vm' wasn't initialized before jumping to cleanup: and calling virDomainObjEndAPI if the VIR_STRDUP fails. So I initialized vm = NULL and also moved the VIR_STRDUP closer to usage and used endjob for goto. Lots of other reasons for failures.
This commit is contained in:
parent
e4c8b67024
commit
c4cfc0d037
@ -19888,7 +19888,7 @@ static int qemuDomainRename(virDomainPtr dom,
|
||||
{
|
||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||
virQEMUDriverConfigPtr cfg = NULL;
|
||||
virDomainObjPtr vm;
|
||||
virDomainObjPtr vm = NULL;
|
||||
virObjectEventPtr event_new = NULL;
|
||||
virObjectEventPtr event_old = NULL;
|
||||
int ret = -1;
|
||||
@ -19902,9 +19902,6 @@ static int qemuDomainRename(virDomainPtr dom,
|
||||
|
||||
virCheckFlags(0, ret);
|
||||
|
||||
if (VIR_STRDUP(new_dom_name, new_name) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(vm = qemuDomObjFromDomain(dom)))
|
||||
goto cleanup;
|
||||
|
||||
@ -19940,6 +19937,9 @@ static int qemuDomainRename(virDomainPtr dom,
|
||||
goto endjob;
|
||||
}
|
||||
|
||||
if (VIR_STRDUP(new_dom_name, new_name) < 0)
|
||||
goto endjob;
|
||||
|
||||
if (virAsprintf(&rename_log_msg, ": domain %s has been renamed to %s\n",
|
||||
vm->def->name, new_name) < 0) {
|
||||
goto endjob;
|
||||
|
Loading…
x
Reference in New Issue
Block a user