41 lines
1.4 KiB
Diff
41 lines
1.4 KiB
Diff
|
|
From dd51b99923c20a289f4b2c9de0cba5d272fbb493 Mon Sep 17 00:00:00 2001
|
||
|
|
From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= <philmd@linaro.org>
|
||
|
|
Date: Mon, 8 Apr 2024 11:41:59 +0200
|
||
|
|
Subject: [PATCH] hw/misc/applesmc: Fix memory leak in reset() handler
|
||
|
|
MIME-Version: 1.0
|
||
|
|
Content-Type: text/plain; charset=UTF-8
|
||
|
|
Content-Transfer-Encoding: 8bit
|
||
|
|
|
||
|
|
AppleSMCData is allocated with g_new0() in applesmc_add_key():
|
||
|
|
release it with g_free().
|
||
|
|
|
||
|
|
Leaked since commit 1ddda5cd36 ("AppleSMC device emulation").
|
||
|
|
|
||
|
|
Cc: qemu-stable@nongnu.org
|
||
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2272
|
||
|
|
Reported-by: Zheyu Ma <zheyuma97@gmail.com>
|
||
|
|
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
|
||
|
|
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
|
||
|
|
Message-Id: <20240408095217.57239-3-philmd@linaro.org>
|
||
|
|
(cherry picked from commit fc09ff2979defdcf8d00c2db94022d5d610e36ba)
|
||
|
|
Signed-off-by: zhujun2 <zhujun2_yewu@cmss.chinamobile.com>
|
||
|
|
---
|
||
|
|
hw/misc/applesmc.c | 1 +
|
||
|
|
1 file changed, 1 insertion(+)
|
||
|
|
|
||
|
|
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
|
||
|
|
index 1b9acaf1d3..e17229025f 100644
|
||
|
|
--- a/hw/misc/applesmc.c
|
||
|
|
+++ b/hw/misc/applesmc.c
|
||
|
|
@@ -269,6 +269,7 @@ static void qdev_applesmc_isa_reset(DeviceState *dev)
|
||
|
|
/* Remove existing entries */
|
||
|
|
QLIST_FOREACH_SAFE(d, &s->data_def, node, next) {
|
||
|
|
QLIST_REMOVE(d, node);
|
||
|
|
+ g_free(d);
|
||
|
|
}
|
||
|
|
s->status = 0x00;
|
||
|
|
s->status_1e = 0x00;
|
||
|
|
--
|
||
|
|
2.41.0.windows.1
|
||
|
|
|