mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
domain_conf: use early return in virDomainObjAssignDef()
Signed-off-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
af8a241816
commit
0f729b6ce0
@ -3928,22 +3928,24 @@ void virDomainObjAssignDef(virDomainObj *domain,
|
|||||||
else
|
else
|
||||||
virDomainDefFree(domain->newDef);
|
virDomainDefFree(domain->newDef);
|
||||||
domain->newDef = g_steal_pointer(def);
|
domain->newDef = g_steal_pointer(def);
|
||||||
} else {
|
return;
|
||||||
if (live) {
|
|
||||||
/* save current configuration to be restored on domain shutdown */
|
|
||||||
if (!domain->newDef)
|
|
||||||
domain->newDef = domain->def;
|
|
||||||
else
|
|
||||||
virDomainDefFree(domain->def);
|
|
||||||
domain->def = g_steal_pointer(def);
|
|
||||||
} else {
|
|
||||||
if (oldDef)
|
|
||||||
*oldDef = domain->def;
|
|
||||||
else
|
|
||||||
virDomainDefFree(domain->def);
|
|
||||||
domain->def = g_steal_pointer(def);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (live) {
|
||||||
|
/* save current configuration to be restored on domain shutdown */
|
||||||
|
if (!domain->newDef)
|
||||||
|
domain->newDef = domain->def;
|
||||||
|
else
|
||||||
|
virDomainDefFree(domain->def);
|
||||||
|
domain->def = g_steal_pointer(def);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldDef)
|
||||||
|
*oldDef = domain->def;
|
||||||
|
else
|
||||||
|
virDomainDefFree(domain->def);
|
||||||
|
domain->def = g_steal_pointer(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user