Skip to content

Commit

Permalink
KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks
Browse files Browse the repository at this point in the history
vcpu->arch.mce_banks is malloc in kvm_arch_vcpu_init(), but
never free in any place, this may cause memory leak. So this
patch fixed to free it in kvm_arch_vcpu_uninit().

Cc: [email protected]
Signed-off-by: Wei Yongjun <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
Wei Yongjun authored and matosatti committed Jan 25, 2010
1 parent 062d5e9 commit 36cb93f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -5088,6 +5088,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)

void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
{
kfree(vcpu->arch.mce_banks);
kvm_free_lapic(vcpu);
down_read(&vcpu->kvm->slots_lock);
kvm_mmu_destroy(vcpu);
Expand Down

0 comments on commit 36cb93f

Please sign in to comment.