mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
test: Cleanup testDomainRenameCallback
Rather than have a need for old_dom_name, let's just VIR_FREE the old name first, then use VIR_STEAL_PTR to handle the swap from the old name to the new name. Signed-off-by: John Ferlan <jferlan@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
1450b19269
commit
0082ee5b5e
@ -2579,7 +2579,6 @@ testDomainRenameCallback(virDomainObjPtr privdom,
|
|||||||
virObjectEventPtr event_old = NULL;
|
virObjectEventPtr event_old = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
char *new_dom_name = NULL;
|
char *new_dom_name = NULL;
|
||||||
char *old_dom_name = NULL;
|
|
||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
@ -2597,9 +2596,8 @@ testDomainRenameCallback(virDomainObjPtr privdom,
|
|||||||
VIR_DOMAIN_EVENT_UNDEFINED_RENAMED);
|
VIR_DOMAIN_EVENT_UNDEFINED_RENAMED);
|
||||||
|
|
||||||
/* Switch name in domain definition. */
|
/* Switch name in domain definition. */
|
||||||
old_dom_name = privdom->def->name;
|
VIR_FREE(privdom->def->name);
|
||||||
privdom->def->name = new_dom_name;
|
VIR_STEAL_PTR(privdom->def->name, new_dom_name);
|
||||||
new_dom_name = NULL;
|
|
||||||
|
|
||||||
event_new = virDomainEventLifecycleNewFromObj(privdom,
|
event_new = virDomainEventLifecycleNewFromObj(privdom,
|
||||||
VIR_DOMAIN_EVENT_DEFINED,
|
VIR_DOMAIN_EVENT_DEFINED,
|
||||||
@ -2607,7 +2605,6 @@ testDomainRenameCallback(virDomainObjPtr privdom,
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(old_dom_name);
|
|
||||||
VIR_FREE(new_dom_name);
|
VIR_FREE(new_dom_name);
|
||||||
virObjectEventStateQueue(driver->eventState, event_old);
|
virObjectEventStateQueue(driver->eventState, event_old);
|
||||||
virObjectEventStateQueue(driver->eventState, event_new);
|
virObjectEventStateQueue(driver->eventState, event_new);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user