Commit 3c0ba05
KVM: x86: fix memoryleak in kvm_arch_vcpu_create()
When allocating memory for mci_ctl2_banks fails, KVM doesn't release
mce_banks leading to memoryleak. Fix this issue by calling kfree()
for it when kcalloc() fails.
Fixes: 281b527 ("KVM: x86: Add emulation for MSR_IA32_MCx_CTL2 MSRs.")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Message-Id: <20220901122300.22298-1-linmiaohe@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>1 parent 0204750 commit 3c0ba05
1 file changed
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11580 | 11580 | | |
11581 | 11581 | | |
11582 | 11582 | | |
11583 | | - | |
| 11583 | + | |
11584 | 11584 | | |
11585 | 11585 | | |
11586 | 11586 | | |
| |||
11634 | 11634 | | |
11635 | 11635 | | |
11636 | 11636 | | |
11637 | | - | |
11638 | 11637 | | |
11639 | 11638 | | |
11640 | 11639 | | |
| |||
0 commit comments