i386: Never free migration blocker objects instead of sometimes
invtsc_mig_blocker has static storage duration. When a CPU with certain features is initialized, and invtsc_mig_blocker is still null, we add a migration blocker and store it in invtsc_mig_blocker. The object is freed when migrate_add_blocker() fails, leaving invtsc_mig_blocker dangling. It is not freed on later failures. Same for hv_passthrough_mig_blocker and hv_no_nonarch_cs_mig_blocker. All failures are actually fatal, so whether we free or not doesn't really matter, except as bad examples to be copied / imitated. Clean this up in a minimal way: never free these blocker objects. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20210720125408.387910-7-armbru@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
aa6f7448eb
commit
a5c051b2cf
|
@ -1437,7 +1437,6 @@ static int hyperv_init_vcpu(X86CPU *cpu)
|
|||
ret = migrate_add_blocker(hv_passthrough_mig_blocker, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_free(hv_passthrough_mig_blocker);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -1452,7 +1451,6 @@ static int hyperv_init_vcpu(X86CPU *cpu)
|
|||
ret = migrate_add_blocker(hv_no_nonarch_cs_mig_blocker, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_free(hv_no_nonarch_cs_mig_blocker);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
@ -1892,7 +1890,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|||
r = migrate_add_blocker(invtsc_mig_blocker, &local_err);
|
||||
if (local_err) {
|
||||
error_report_err(local_err);
|
||||
error_free(invtsc_mig_blocker);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue