From: Fabiano Rosas <farosas@suse.de>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Hanna Reitz <hreitz@redhat.com>
Subject: Re: [PATCH] block: Fix leak in send_qmp_error_event
Date: Mon, 11 Nov 2024 14:10:31 -0300 [thread overview]
Message-ID: <87jzd9itmg.fsf@suse.de> (raw)
In-Reply-To: <aeef7f22-1102-4d03-a473-564d65e29892@linaro.org>
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 11/11/24 14:52, Fabiano Rosas wrote:
>> ASAN detected a leak when running the ahci-test
>> /ahci/io/dma/lba28/retry:
>>
>> Direct leak of 35 byte(s) in 1 object(s) allocated from:
>> #0 in malloc
>> #1 in __vasprintf_internal
>> #2 in vasprintf
>> #3 in g_vasprintf
>> #4 in g_strdup_vprintf
>> #5 in g_strdup_printf
>> #6 in object_get_canonical_path ../qom/object.c:2096:19
>> #7 in blk_get_attached_dev_id_or_path ../block/block-backend.c:1033:12
>> #8 in blk_get_attached_dev_path ../block/block-backend.c:1047:12
>> #9 in send_qmp_error_event ../block/block-backend.c:2140:36
>> #10 in blk_error_action ../block/block-backend.c:2172:9
>> #11 in ide_handle_rw_error ../hw/ide/core.c:875:5
>> #12 in ide_dma_cb ../hw/ide/core.c:894:13
>> #13 in dma_complete ../system/dma-helpers.c:107:9
>> #14 in dma_blk_cb ../system/dma-helpers.c:129:9
>> #15 in blk_aio_complete ../block/block-backend.c:1552:9
>> #16 in blk_aio_write_entry ../block/block-backend.c:1619:5
>> #17 in coroutine_trampoline ../util/coroutine-ucontext.c:175:9
>>
>> Plug the leak by freeing the device path string.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>> block/block-backend.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/block/block-backend.c b/block/block-backend.c
>> index 85bcdedcef..a3b7f00188 100644
>> --- a/block/block-backend.c
>> +++ b/block/block-backend.c
>> @@ -2134,13 +2134,14 @@ static void send_qmp_error_event(BlockBackend *blk,
>> {
>> IoOperationType optype;
>> BlockDriverState *bs = blk_bs(blk);
>> + char *path = blk_get_attached_dev_path(blk);
>
> Preferably using g_autofree,
Of course, I'll repost. Thanks!
prev parent reply other threads:[~2024-11-11 17:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-11 14:52 [PATCH] block: Fix leak in send_qmp_error_event Fabiano Rosas
2024-11-11 16:58 ` Philippe Mathieu-Daudé
2024-11-11 17:10 ` Fabiano Rosas [this message]
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=87jzd9itmg.fsf@suse.de \
--to=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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.