[PATCH 3/8] mcf5208: fix leak from qemu_allocate_irqs

Paolo Bonzini posted 8 patches 6 years, 2 months ago
Maintainers: Fam Zheng <fam@euphon.net>, Aleksandar Markovic <amarkovic@wavecomp.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Thomas Huth <huth@tuxfamily.org>, Helge Deller <deller@gmx.de>, John Snow <jsnow@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Richard Henderson <rth@twiddle.net>, Aleksandar Rikalo <arikalo@wavecomp.com>, Michael Walle <michael@walle.cc>, "Hervé Poussineau" <hpoussin@reactos.org>, "Alex Bennée" <alex.bennee@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>
[PATCH 3/8] mcf5208: fix leak from qemu_allocate_irqs
Posted by Paolo Bonzini 6 years, 2 months ago
The array returned by qemu_allocate_irqs is malloced, free it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/m68k/mcf5208.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
index 012710d..60c5802 100644
--- a/hw/m68k/mcf5208.c
+++ b/hw/m68k/mcf5208.c
@@ -273,6 +273,8 @@ static void mcf5208evb_init(MachineState *machine)
                      0xfc030000, pic + 36);
     }
 
+    g_free(pic);
+
     /*  0xfc000000 SCM.  */
     /*  0xfc004000 XBS.  */
     /*  0xfc008000 FlexBus CS.  */
-- 
1.8.3.1



Re: [PATCH 3/8] mcf5208: fix leak from qemu_allocate_irqs
Posted by Thomas Huth 6 years, 2 months ago
On 01/10/2019 15.36, Paolo Bonzini wrote:
> The array returned by qemu_allocate_irqs is malloced, free it.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/m68k/mcf5208.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/m68k/mcf5208.c b/hw/m68k/mcf5208.c
> index 012710d..60c5802 100644
> --- a/hw/m68k/mcf5208.c
> +++ b/hw/m68k/mcf5208.c
> @@ -273,6 +273,8 @@ static void mcf5208evb_init(MachineState *machine)
>                       0xfc030000, pic + 36);
>      }
>  
> +    g_free(pic);
> +
>      /*  0xfc000000 SCM.  */
>      /*  0xfc004000 XBS.  */
>      /*  0xfc008000 FlexBus CS.  */
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>