[PATCH 01/24] target/arm/hvf: Release memory allocated by hv_vcpu_config_create()

Philippe Mathieu-Daudé posted 24 patches 3 days, 4 hours ago
[PATCH 01/24] target/arm/hvf: Release memory allocated by hv_vcpu_config_create()
Posted by Philippe Mathieu-Daudé 3 days, 4 hours ago
hv_vcpu_config_create() is documented in <Hypervisor/hv_vcpu_config.h>
as:

  /*!
   @abstract Creates a vcpu configuration object.
   @result A new vcpu configuration object. This should be released with os_release when no longer used.
   */
  OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT
  hv_vcpu_config_t hv_vcpu_config_create(void);

Release the memory allocated by hv_vcpu_config_create() with
os_release().

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/hvf/hvf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index b77db99079e..d67372218de 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -150,6 +150,8 @@ void hvf_arm_init_debug(void)
     max_hw_wps = hvf_arm_num_wrps(config);
     hw_watchpoints =
         g_array_sized_new(true, true, sizeof(HWWatchpoint), max_hw_wps);
+
+    os_release(config);
 }
 
 #define HVF_SYSREG(crn, crm, op0, op1, op2) \
-- 
2.51.0


Re: [PATCH 01/24] target/arm/hvf: Release memory allocated by hv_vcpu_config_create()
Posted by Richard Henderson 3 days, 2 hours ago
On 9/3/25 12:06, Philippe Mathieu-Daudé wrote:
> hv_vcpu_config_create() is documented in <Hypervisor/hv_vcpu_config.h>
> as:
> 
>    /*!
>     @abstract Creates a vcpu configuration object.
>     @result A new vcpu configuration object. This should be released with os_release when no longer used.
>     */
>    OS_OBJECT_RETURNS_RETAINED OS_WARN_RESULT
>    hv_vcpu_config_t hv_vcpu_config_create(void);
> 
> Release the memory allocated by hv_vcpu_config_create() with
> os_release().
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   target/arm/hvf/hvf.c | 2 ++
>   1 file changed, 2 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~