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(-)