All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Zhu Wei <zachwade.k@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	 Markus Armbruster <armbru@pond.sub.org>,
	niming <niming@sangfor.com.cn>, zhuwei <zhuwei@sangfor.com.cn>
Subject: Re: [PATCH v2 1/1 ] block/monitor: fix BlockJobInfoList leak in hmp_info_block_jobs()
Date: Mon, 23 Nov 2026 07:28:24 -0600	[thread overview]
Message-ID: <awQ_SF5DsUNmztdP@redhat.com> (raw)
In-Reply-To: <20261122114849.1672198-2-zhuwei@sangfor.com.cn>

On Sun, Nov 22, 2026 at 07:48:49PM +0800, Zhu Wei wrote:
> From: zhuwei <zhuwei@sangfor.com.cn>
> 
> hmp_info_block_jobs() uses 'list' both as the head of the BlockJobInfoList
> returned by qmp_query_block_jobs() and as the iterator of the while loop.
> Once the loop finishes, 'list' is NULL, so the call to
> qapi_free_BlockJobInfoList(list) at the end of the function frees nothing
> and the whole list returned by qmp_query_block_jobs() is leaked.
> 
> Keep the head of the list in a separate variable and free that one after
> the loop, so the entire list is released as intended.
> 
> Fixes: fb5458cd10a1 ("qmp: add query-block-jobs")
> 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(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org



  reply	other threads:[~2026-11-23 13:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-23 13:34     ` zhuwei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awQ_SF5DsUNmztdP@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@pond.sub.org \
    --cc=niming@sangfor.com.cn \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=zachwade.k@gmail.com \
    --cc=zhuwei@sangfor.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.