KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks

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: stable@kernel.org
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
Wei Yongjun 2010-01-22 14:18:47 +08:00 committed by Marcelo Tosatti
parent 062d5e9b0d
commit 36cb93fd6b
1 changed files with 1 additions and 0 deletions

View File

@ -5088,6 +5088,7 @@ fail:
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);