From 12a51d983de118cf2258fe238b22fabedb4a5ffc Mon Sep 17 00:00:00 2001 From: Mauro Matteo Cascella Date: Thu, 22 Dec 2022 18:29:15 +0100 Subject: hw/nubus/nubus-device: Fix memory leak in nubus_device_realize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laurent Vivier Message-Id: <20221222172915.671597-1-mcascell@redhat.com> Signed-off-by: Philippe Mathieu-Daudé --- hw/nubus/nubus-device.c | 1 + 1 file changed, 1 insertion(+) (limited to 'hw/nubus/nubus-device.c') diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 0f1852f..49008e4 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; -- cgit v1.1