[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] i386/hvf: Fixes startup memory leak (vmcs caps)
From: |
Phil Dennis-Jordan |
Subject: |
[PATCH 3/5] i386/hvf: Fixes startup memory leak (vmcs caps) |
Date: |
Tue, 5 Nov 2024 16:57:58 +0100 |
The hvf_caps data structure only exists once as part of the hvf accelerator
state, but it is initialised during vCPU initialisation. This change therefore
adds a check to ensure memory for it is only allocated once.
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
---
target/i386/hvf/hvf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index 68dc5d9cf75..8527bce6eef 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -239,7 +239,9 @@ int hvf_arch_init_vcpu(CPUState *cpu)
init_emu();
init_decoder();
- hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
+ if (hvf_state->hvf_caps == NULL) {
+ hvf_state->hvf_caps = g_new0(struct hvf_vcpu_caps, 1);
+ }
env->hvf_mmio_buf = g_new(char, 4096);
if (x86cpu->vmware_cpuid_freq) {
--
2.39.3 (Apple Git-145)
- [PATCH 0/5] i386/hvf: x2apic support and some small fixes, Phil Dennis-Jordan, 2024/11/05
- [PATCH 1/5] i386/hvf: Integrates x2APIC support with hvf accel, Phil Dennis-Jordan, 2024/11/05
- [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD, Phil Dennis-Jordan, 2024/11/05
- [PATCH 3/5] i386/hvf: Fixes startup memory leak (vmcs caps),
Phil Dennis-Jordan <=
- [PATCH 4/5] i386/hvf: Raise exception on error setting APICBASE, Phil Dennis-Jordan, 2024/11/05
- [PATCH 5/5] i386/hvf: Removes duplicate/shadowed variables in hvf_vcpu_exec, Phil Dennis-Jordan, 2024/11/05
- Re: [PATCH 0/5] i386/hvf: x2apic support and some small fixes, Roman Bolshakov, 2024/11/06