qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-arm] [Qemu-devel] [PATCH v2 07/18] hw/nvram/fw_cfg: Add fw_cfg


From: Markus Armbruster
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v2 07/18] hw/nvram/fw_cfg: Add fw_cfg_common_unrealize()
Date: Sat, 09 Mar 2019 15:47:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Philippe Mathieu-Daudé <address@hidden> writes:

> Back in abe147e0ce4 when fw_cfg_add_file() was introduced, there
> was no QOM design, object where not created and released at runtime.
> Later 38f3adc34d finished the QOM conversion of the fw_cfg device,
> adding the fw_cfg_common_realize() method.
> The time has come to add the equivalent destructor and release the
> memory allocated for 'files'.
>
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
> ---
>  hw/nvram/fw_cfg.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index b2dc0a80cb..0fb020edce 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -959,6 +959,13 @@ static void fw_cfg_common_realize(DeviceState *dev, 
> Error **errp)
>      qemu_add_machine_init_done_notifier(&s->machine_ready);
>  }
>  
> +static void fw_cfg_common_unrealize(DeviceState *dev, Error **errp)
> +{
> +    FWCfgState *s = FW_CFG(dev);
> +
> +    g_free(s->files);
> +}
> +

Still leaks at least s->entries[0], s->entries[1], s->entry_order,
doesn't it?

>  FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
>                                  AddressSpace *dma_as)
>  {
> @@ -1127,6 +1134,7 @@ static void fw_cfg_io_class_init(ObjectClass *klass, 
> void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->realize = fw_cfg_io_realize;
> +    dc->unrealize = fw_cfg_common_unrealize;
>      dc->props = fw_cfg_io_properties;
>  }
>  
> @@ -1190,6 +1198,7 @@ static void fw_cfg_mem_class_init(ObjectClass *klass, 
> void *data)
>      DeviceClass *dc = DEVICE_CLASS(klass);
>  
>      dc->realize = fw_cfg_mem_realize;
> +    dc->unrealize = fw_cfg_common_unrealize;
>      dc->props = fw_cfg_mem_properties;
>  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]