diff options
author | Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> | 2012-06-19 09:04:56 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-06-19 09:10:25 -0400 |
commit | 9e40b67bf2bfaa40b28354c501a72fd001a1397a (patch) | |
tree | ac0cb17a5a5d869d01a3288ff6ab4003628a7adc /arch/x86/kvm/x86.c | |
parent | a1e4ccb990447df0fe83d164d9a7bc2e6c4b7db7 (diff) |
KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()
The following commit did not care about the error handling path:
commit c1a7b32a14138f908df52d7c53b5ce3415ec6b50
KVM: Avoid wasting pages for small lpage_info arrays
If memory allocation fails, vfree() will be called with the address
returned by kzalloc(). This patch fixes this issue.
Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/x86.c')
-rw-r--r-- | arch/x86/kvm/x86.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a01a4241bc6b..6ed5983f78ff 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -6350,7 +6350,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) | |||
6350 | 6350 | ||
6351 | out_free: | 6351 | out_free: |
6352 | for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { | 6352 | for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) { |
6353 | vfree(slot->arch.lpage_info[i]); | 6353 | kvm_kvfree(slot->arch.lpage_info[i]); |
6354 | slot->arch.lpage_info[i] = NULL; | 6354 | slot->arch.lpage_info[i] = NULL; |
6355 | } | 6355 | } |
6356 | return -ENOMEM; | 6356 | return -ENOMEM; |