qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] nubus-device: fix memory leak in nubus_device_realize


From: Laurent Vivier
Subject: Re: [PATCH] nubus-device: fix memory leak in nubus_device_realize
Date: Thu, 22 Dec 2022 18:32:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0

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>



reply via email to

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