From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>
Subject: [PATCH 1/2 v2] KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks
Date: Fri, 22 Jan 2010 14:41:12 +0800 [thread overview]
Message-ID: <4B594888.7050100@cn.fujitsu.com> (raw)
In-Reply-To: <4B594347.2010904@cn.fujitsu.com>
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().
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
arch/x86/kvm/x86.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 56a90a6..c27ebb1 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5470,6 +5470,7 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
{
int idx;
+ kfree(vcpu->arch.mce_banks);
kvm_free_lapic(vcpu);
idx = srcu_read_lock(&vcpu->kvm->srcu);
kvm_mmu_destroy(vcpu);
next prev parent reply other threads:[~2010-01-22 6:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 6:18 [PATCH 1/2] KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks Wei Yongjun
2010-01-22 6:21 ` [PATCH 2/2] KVM: x86: Fix leak of free lapic date in kvm_arch_vcpu_init() Wei Yongjun
2010-01-22 6:41 ` Wei Yongjun [this message]
2010-01-22 8:55 ` [PATCH] KVM: MMU: Remove some useless code from alloc_mmu_pages() Wei Yongjun
2010-01-23 19:23 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B594888.7050100@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox