[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] nubus-device: ensure that name is freed after use in nub
From: |
Laurent Vivier |
Subject: |
Re: [PATCH 2/2] nubus-device: ensure that name is freed after use in nubus_device_realize() |
Date: |
Mon, 4 Oct 2021 08:50:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
Le 02/10/2021 à 14:31, Mark Cave-Ayland a écrit :
> Coverity points out that there is memory leak because name is never freed
> after
> use in nubus_device_realize().
>
> Fixes: Coverity CID 1464062
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
> hw/nubus/nubus-device.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c
> index 0f1852f671..64f837e44d 100644
> --- a/hw/nubus/nubus-device.c
> +++ b/hw/nubus/nubus-device.c
> @@ -78,6 +78,7 @@ static void nubus_device_realize(DeviceState *dev, Error
> **errp)
> name = g_strdup_printf("nubus-slot-%x-declaration-rom", nd->slot);
> memory_region_init_rom(&nd->decl_rom, OBJECT(dev), name, size,
> &error_abort);
> + g_free(name);
> ret = load_image_mr(path, &nd->decl_rom);
> g_free(path);
> if (ret < 0) {
>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>