All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] block/monitor: fix BlockJobInfoList leak in hmp_info_block_jobs()
@ 2026-11-22 11:48 Zhu Wei
  2026-11-22 11:48 ` [PATCH v2 1/1 ] " Zhu Wei
  0 siblings, 1 reply; 4+ messages in thread
From: Zhu Wei @ 2026-11-22 11:48 UTC (permalink / raw)
  To: qemu-devel, qemu-block; +Cc: Markus Armbruster, niming, zhuwei, zachwade . k

From: zhuwei <zhuwei@sangfor.com.cn>

Hi,

hmp_info_block_jobs() walks the BlockJobInfoList returned by
qmp_query_block_jobs() with a single variable, 'list', which is used both
as the head of the list and as the loop iterator.  By the time the loop
terminates 'list' is NULL, so the trailing call to
qapi_free_BlockJobInfoList(list) frees nothing and the full list handed
back by qmp_query_block_jobs() is leaked.  Every "info block-jobs" HMP
command run while a job is active (stream, mirror, commit, backup...)
leaks the whole list.

The patch keeps the head of the list in a separate variable ('head') and
frees that one after the loop, so the list is released as intended.  No
functional change is expected; it only fixes the leak.

Signed-off-by: niming <niming@sangfor.com.cn>
Signed-off-by: zhuwei <zhuwei@sangfor.com.cn>
---
 block/monitor/block-hmp-cmds.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-23 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 11:48 [PATCH v2 0/1] block/monitor: fix BlockJobInfoList leak in hmp_info_block_jobs() Zhu Wei
2026-11-22 11:48 ` [PATCH v2 1/1 ] " Zhu Wei
2026-11-23 13:28   ` Eric Blake
2026-11-23 13:34     ` zhuwei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.