qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nubus-device: fix memory leak in nubus_device_realize
@ 2022-12-22 17:29 Mauro Matteo Cascella
  2022-12-22 17:32 ` Laurent Vivier
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mauro Matteo Cascella @ 2022-12-22 17:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, mcascell

Local variable "name" is allocated through strdup_printf and should be
freed with g_free() to avoid memory leak.

Fixes: 3616f424 ("nubus-device: add romfile property for loading declaration ROMs")
Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
---
 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..49008e4938 100644
--- a/hw/nubus/nubus-device.c
+++ b/hw/nubus/nubus-device.c
@@ -80,6 +80,7 @@ static void nubus_device_realize(DeviceState *dev, Error **errp)
                                &error_abort);
         ret = load_image_mr(path, &nd->decl_rom);
         g_free(path);
+        g_free(name);
         if (ret < 0) {
             error_setg(errp, "could not load romfile \"%s\"", nd->romfile);
             return;
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] nubus-device: fix memory leak in nubus_device_realize
  2022-12-22 17:29 [PATCH] nubus-device: fix memory leak in nubus_device_realize Mauro Matteo Cascella
@ 2022-12-22 17:32 ` Laurent Vivier
  2022-12-23 10:53 ` Philippe Mathieu-Daudé
  2023-01-24 20:58 ` Mauro Matteo Cascella
  2 siblings, 0 replies; 4+ messages in thread
From: Laurent Vivier @ 2022-12-22 17:32 UTC (permalink / raw)
  To: Mauro Matteo Cascella, qemu-devel

Le 22/12/2022 à 18:29, Mauro Matteo Cascella a écrit :
> Local variable "name" is allocated through strdup_printf and should be
> freed with g_free() to avoid memory leak.
> 
> Fixes: 3616f424 ("nubus-device: add romfile property for loading declaration ROMs")
> Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
> ---
>   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..49008e4938 100644
> --- a/hw/nubus/nubus-device.c
> +++ b/hw/nubus/nubus-device.c
> @@ -80,6 +80,7 @@ static void nubus_device_realize(DeviceState *dev, Error **errp)
>                                  &error_abort);
>           ret = load_image_mr(path, &nd->decl_rom);
>           g_free(path);
> +        g_free(name);
>           if (ret < 0) {
>               error_setg(errp, "could not load romfile \"%s\"", nd->romfile);
>               return;

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nubus-device: fix memory leak in nubus_device_realize
  2022-12-22 17:29 [PATCH] nubus-device: fix memory leak in nubus_device_realize Mauro Matteo Cascella
  2022-12-22 17:32 ` Laurent Vivier
@ 2022-12-23 10:53 ` Philippe Mathieu-Daudé
  2023-01-24 20:58 ` Mauro Matteo Cascella
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-23 10:53 UTC (permalink / raw)
  To: Mauro Matteo Cascella, qemu-devel; +Cc: laurent

On 22/12/22 18:29, Mauro Matteo Cascella wrote:
> Local variable "name" is allocated through strdup_printf and should be
> freed with g_free() to avoid memory leak.
> 
> Fixes: 3616f424 ("nubus-device: add romfile property for loading declaration ROMs")
> Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
> ---
>   hw/nubus/nubus-device.c | 1 +
>   1 file changed, 1 insertion(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] nubus-device: fix memory leak in nubus_device_realize
  2022-12-22 17:29 [PATCH] nubus-device: fix memory leak in nubus_device_realize Mauro Matteo Cascella
  2022-12-22 17:32 ` Laurent Vivier
  2022-12-23 10:53 ` Philippe Mathieu-Daudé
@ 2023-01-24 20:58 ` Mauro Matteo Cascella
  2 siblings, 0 replies; 4+ messages in thread
From: Mauro Matteo Cascella @ 2023-01-24 20:58 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, Philippe Mathieu-Daudé

On Thu, Dec 22, 2022 at 6:29 PM Mauro Matteo Cascella
<mcascell@redhat.com> wrote:
>
> Local variable "name" is allocated through strdup_printf and should be
> freed with g_free() to avoid memory leak.
>
> Fixes: 3616f424 ("nubus-device: add romfile property for loading declaration ROMs")
> Signed-off-by: Mauro Matteo Cascella <mcascell@redhat.com>
> ---
>  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..49008e4938 100644
> --- a/hw/nubus/nubus-device.c
> +++ b/hw/nubus/nubus-device.c
> @@ -80,6 +80,7 @@ static void nubus_device_realize(DeviceState *dev, Error **errp)
>                                 &error_abort);
>          ret = load_image_mr(path, &nd->decl_rom);
>          g_free(path);
> +        g_free(name);
>          if (ret < 0) {
>              error_setg(errp, "could not load romfile \"%s\"", nd->romfile);
>              return;
> --
> 2.38.1

Hi, any updates here? Is this patch going to be merged?

Thanks,

--
Mauro Matteo Cascella
Red Hat Product Security
PGP-Key ID: BB3410B0



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-24 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22 17:29 [PATCH] nubus-device: fix memory leak in nubus_device_realize Mauro Matteo Cascella
2022-12-22 17:32 ` Laurent Vivier
2022-12-23 10:53 ` Philippe Mathieu-Daudé
2023-01-24 20:58 ` Mauro Matteo Cascella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).