diff mbox series

[2/5] hw/arm/mps2-tz.c: Free mscname string in make_dma()

Message ID 20181204132952.2601-3-peter.maydell@linaro.org
State Superseded
Headers show
Series arm: five simple memory leak fixes | expand

Commit Message

Peter Maydell Dec. 4, 2018, 1:29 p.m. UTC
The clang leak sanitizer spots a (one-off, trivial) memory
leak in make_dma() due to a missing free.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

---
 hw/arm/mps2-tz.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.19.2

Comments

Richard Henderson Dec. 4, 2018, 1:57 p.m. UTC | #1
On 12/4/18 7:29 AM, Peter Maydell wrote:
> The clang leak sanitizer spots a (one-off, trivial) memory

> leak in make_dma() due to a missing free.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

> ---

>  hw/arm/mps2-tz.c | 1 +

>  1 file changed, 1 insertion(+)


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



r~
Philippe Mathieu-Daudé Dec. 4, 2018, 2:26 p.m. UTC | #2
On 4/12/18 14:29, Peter Maydell wrote:
> The clang leak sanitizer spots a (one-off, trivial) memory

> leak in make_dma() due to a missing free.

> 

> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>


> ---

>  hw/arm/mps2-tz.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c

> index 6dd02ae47e8..82b1d020a58 100644

> --- a/hw/arm/mps2-tz.c

> +++ b/hw/arm/mps2-tz.c

> @@ -322,6 +322,7 @@ static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,

>      sysbus_connect_irq(s, 2, qdev_get_gpio_in_named(iotkitdev,

>                                                      "EXP_IRQ", 57 + i * 3));

>  

> +    g_free(mscname);

>      return sysbus_mmio_get_region(s, 0);

>  }

>  

>
diff mbox series

Patch

diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 6dd02ae47e8..82b1d020a58 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -322,6 +322,7 @@  static MemoryRegion *make_dma(MPS2TZMachineState *mms, void *opaque,
     sysbus_connect_irq(s, 2, qdev_get_gpio_in_named(iotkitdev,
                                                     "EXP_IRQ", 57 + i * 3));
 
+    g_free(mscname);
     return sysbus_mmio_get_region(s, 0);
 }