From: Philippe Mathieu-Daudé <phi...@linaro.org> AppleSMCData is allocated with g_new0() in applesmc_add_key(): release it with g_free().
Leaked since commit 1ddda5cd36 ("AppleSMC device emulation"). Cc: qemu-sta...@nongnu.org Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2272 Reported-by: Zheyu Ma <zheyum...@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org> Reviewed-by: Peter Maydell <peter.mayd...@linaro.org> Message-Id: <20240408095217.57239-3-phi...@linaro.org> (cherry picked from commit fc09ff2979defdcf8d00c2db94022d5d610e36ba) Signed-off-by: Michael Tokarev <m...@tls.msk.ru> diff --git a/hw/misc/applesmc.c b/hw/misc/applesmc.c index 5f9c742e50..80642efc57 100644 --- a/hw/misc/applesmc.c +++ b/hw/misc/applesmc.c @@ -273,6 +273,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.39.2