Patchwork target-arm: Fix use of free() in cpu_arm_close()

login
register
mail settings
Submitter Andreas Färber
Date Oct. 10, 2011, 12:52 p.m.
Message ID <1318251148-2931-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/118732/
State New
Headers show

Comments

Andreas Färber - Oct. 10, 2011, 12:52 p.m.
env is allocated in cpu_arm_init() with g_malloc0(), so free with g_free().

Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-arm/helper.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Andreas Färber - Oct. 20, 2011, 2:18 p.m.
Am 10.10.2011 14:52, schrieb Andreas Färber:
> env is allocated in cpu_arm_init() with g_malloc0(), so free with g_free().
> 
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  target-arm/helper.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index d3a3ba2..8195c56 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -471,7 +471,7 @@ static uint32_t cpu_arm_find_by_name(const char *name)
>  
>  void cpu_arm_close(CPUARMState *env)
>  {
> -    free(env);
> +    g_free(env);
>  }
>  
>  uint32_t cpsr_read(CPUARMState *env)

Ping! Didn't see this in the pull request... Should it go through
qemu-trivial instead?

Andreas
Peter Maydell - Oct. 20, 2011, 2:27 p.m.
On 20 October 2011 15:18, Andreas Färber <afaerber@suse.de> wrote:
> Am 10.10.2011 14:52, schrieb Andreas Färber:
>> env is allocated in cpu_arm_init() with g_malloc0(), so free with g_free().
>>
>> Cc: Peter Maydell <peter.maydell@linaro.org>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>  target-arm/helper.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/target-arm/helper.c b/target-arm/helper.c
>> index d3a3ba2..8195c56 100644
>> --- a/target-arm/helper.c
>> +++ b/target-arm/helper.c
>> @@ -471,7 +471,7 @@ static uint32_t cpu_arm_find_by_name(const char *name)
>>
>>  void cpu_arm_close(CPUARMState *env)
>>  {
>> -    free(env);
>> +    g_free(env);
>>  }
>>
>>  uint32_t cpsr_read(CPUARMState *env)
>
> Ping! Didn't see this in the pull request... Should it go through
> qemu-trivial instead?

Rats, missed that one. I guess I'd better redo the pullreq.

-- PMM

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index d3a3ba2..8195c56 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -471,7 +471,7 @@  static uint32_t cpu_arm_find_by_name(const char *name)
 
 void cpu_arm_close(CPUARMState *env)
 {
-    free(env);
+    g_free(env);
 }
 
 uint32_t cpsr_read(CPUARMState *env)