aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-04-08 11:41:59 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-04-10 09:09:34 +0200
commitfc09ff2979defdcf8d00c2db94022d5d610e36ba (patch)
tree8f5e00d33e74f1fa04c24b13db2f30a4c1db8026
parent5c338216f57a433d897f30b258063ea75319b597 (diff)
downloadqemu-fc09ff2979defdcf8d00c2db94022d5d610e36ba.zip
qemu-fc09ff2979defdcf8d00c2db94022d5d610e36ba.tar.gz
qemu-fc09ff2979defdcf8d00c2db94022d5d610e36ba.tar.bz2
hw/misc/applesmc: Fix memory leak in reset() handler
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>
-rw-r--r--hw/misc/applesmc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c
index 8e65816..14e3ef6 100644
--- a/hw/misc/applesmc.c
+++ b/hw/misc/applesmc.c
@@ -274,6 +274,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;