conf: Don't reuse variable for different object in virDomainCheckpointRedefinePrep

The 'other' variable was used to store the parent of the redefined
checkpoint and then the existing version of the currently redefined
checkpoint. Make it less confusing by adding a 'parent' variable for the
first case.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-10-01 08:00:26 +02:00
parent e0a4a011c1
commit 4d60e7fdd4

View File

@ -534,6 +534,7 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
{
virDomainCheckpointDefPtr def = *defptr;
char uuidstr[VIR_UUID_STRING_BUFLEN];
virDomainMomentObjPtr parent = NULL;
virDomainMomentObjPtr other = NULL;
virDomainCheckpointDefPtr otherdef = NULL;
@ -552,12 +553,13 @@ virDomainCheckpointRedefinePrep(virDomainObjPtr vm,
if (virDomainCheckpointAlignDisks(def) < 0)
return -1;
if (def->parent.parent_name)
other = virDomainCheckpointFindByName(vm->checkpoints,
def->parent.parent_name);
if (other == virDomainCheckpointGetCurrent(vm->checkpoints)) {
*update_current = true;
virDomainCheckpointSetCurrent(vm->checkpoints, NULL);
if (def->parent.parent_name &&
(parent = virDomainCheckpointFindByName(vm->checkpoints,
def->parent.parent_name))) {
if (parent == virDomainCheckpointGetCurrent(vm->checkpoints)) {
*update_current = true;
virDomainCheckpointSetCurrent(vm->checkpoints, NULL);
}
}
other = virDomainCheckpointFindByName(vm->checkpoints, def->parent.name);