* [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log
@ 2025-10-23 6:31 zhaoguohan_salmon
2025-10-23 8:18 ` Philippe Mathieu-Daudé
2025-10-27 19:15 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: zhaoguohan_salmon @ 2025-10-23 6:31 UTC (permalink / raw)
To: kraxel; +Cc: open list:All patches CC here, GuoHan Zhao
From: GuoHan Zhao <zhaoguohan@kylinos.cn>
The FirmwareLog object returned by qmp_query_firmware_log() was
not being freed, causing a memory leak.
Use g_autoptr to ensure the object is automatically freed when
it goes out of scope.
Fixes: c8aa8120313f ("hw/uefi: add 'info firmware-log' hmp monitor command.")
Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
---
hw/uefi/ovmf-log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/uefi/ovmf-log.c b/hw/uefi/ovmf-log.c
index 98ebb0209491..850ef21f8859 100644
--- a/hw/uefi/ovmf-log.c
+++ b/hw/uefi/ovmf-log.c
@@ -261,7 +261,7 @@ void hmp_info_firmware_log(Monitor *mon, const QDict *qdict)
g_autofree gchar *log_esc = NULL;
g_autofree guchar *log_out = NULL;
Error *err = NULL;
- FirmwareLog *log;
+ g_autoptr(FirmwareLog) log = NULL;
gsize log_len;
int64_t maxsize;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log
2025-10-23 6:31 [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log zhaoguohan_salmon
@ 2025-10-23 8:18 ` Philippe Mathieu-Daudé
2025-10-27 19:15 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-23 8:18 UTC (permalink / raw)
To: zhaoguohan_salmon, kraxel; +Cc: open list:All patches CC here, GuoHan Zhao
On 23/10/25 08:31, zhaoguohan_salmon@163.com wrote:
> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
>
> The FirmwareLog object returned by qmp_query_firmware_log() was
> not being freed, causing a memory leak.
>
> Use g_autoptr to ensure the object is automatically freed when
> it goes out of scope.
>
> Fixes: c8aa8120313f ("hw/uefi: add 'info firmware-log' hmp monitor command.")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
> hw/uefi/ovmf-log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log
2025-10-23 6:31 [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log zhaoguohan_salmon
2025-10-23 8:18 ` Philippe Mathieu-Daudé
@ 2025-10-27 19:15 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-10-27 19:15 UTC (permalink / raw)
To: zhaoguohan_salmon, kraxel; +Cc: open list:All patches CC here, GuoHan Zhao
On 23/10/25 08:31, zhaoguohan_salmon@163.com wrote:
> From: GuoHan Zhao <zhaoguohan@kylinos.cn>
>
> The FirmwareLog object returned by qmp_query_firmware_log() was
> not being freed, causing a memory leak.
>
> Use g_autoptr to ensure the object is automatically freed when
> it goes out of scope.
>
> Fixes: c8aa8120313f ("hw/uefi: add 'info firmware-log' hmp monitor command.")
> Signed-off-by: GuoHan Zhao <zhaoguohan@kylinos.cn>
> ---
> hw/uefi/ovmf-log.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Already merged as commit b6478122f059274b19805e14d12f76d2c0272ad4.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-27 19:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 6:31 [PATCH] hw/uefi/ovmf-log: Fix memory leak in hmp_info_firmware_log zhaoguohan_salmon
2025-10-23 8:18 ` Philippe Mathieu-Daudé
2025-10-27 19:15 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).