From: Fabiano Rosas <farosas@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [PATCH 4/4] tests/qtest/iommu-smmuv3-test: Free QPCIDevice
Date: Fri, 27 Feb 2026 16:13:50 -0300 [thread overview]
Message-ID: <87fr6m579t.fsf@suse.de> (raw)
In-Reply-To: <20260227135736.2280161-5-peter.maydell@linaro.org>
Peter Maydell <peter.maydell@linaro.org> writes:
> The QPCIDevice we get via qpci_device_foreach() is allocated
> memory, and we need to g_free() it after use.
>
> This fixes asan leaks like this:
>
> Direct leak of 64 byte(s) in 1 object(s) allocated from:
> #0 0x622a5f16913d in calloc (/home/pm215/qemu/build/arm-clang/tests/qtest/iommu-smmuv3-test+0x1d413d) (BuildId: bc598be1f4ad6d1a9a600c55aeef36108bdb6a04)
> #1 0x73ee41c0f771 in g_malloc0 (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x63771) (BuildId: 116e142b9b52c8a4dfd403e759e71ab8f95d8bb3)
> #2 0x622a5f1d4cec in qpci_device_find /home/pm215/qemu/build/arm-clang/../../tests/qtest/libqos/pci.c:82:11
> #3 0x622a5f1d4cec in qpci_device_foreach /home/pm215/qemu/build/arm-clang/../../tests/qtest/libqos/pci.c:34:19
> #4 0x622a5f23cc73 in setup_qtest_pci_device /home/pm215/qemu/build/arm-clang/../../tests/qtest/iommu-smmuv3-test.c:45:5
> #5 0x622a5f23cc73 in run_smmuv3_translation /home/pm215/qemu/build/arm-clang/../../tests/qtest/iommu-smmuv3-test.c:74:11
>
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> tests/qtest/iommu-smmuv3-test.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tests/qtest/iommu-smmuv3-test.c b/tests/qtest/iommu-smmuv3-test.c
> index cced49a9b6..dae9821b92 100644
> --- a/tests/qtest/iommu-smmuv3-test.c
> +++ b/tests/qtest/iommu-smmuv3-test.c
> @@ -77,6 +77,7 @@ static void run_smmuv3_translation(const QSMMUTestConfig *cfg)
> g_test_message("### SMMUv3 translation mode=%d sec_sid=%d ###",
> cfg->trans_mode, cfg->sec_sid);
> qsmmu_run_translation_case(qts, dev, bar, VIRT_SMMU_BASE, cfg);
> + g_free(dev);
> qtest_quit(qts);
> }
Reviewed-by: Fabiano Rosas <farosas@suse.de>
next prev parent reply other threads:[~2026-02-27 19:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 13:57 [PATCH 0/4] arm: Fix some memory leaks Peter Maydell
2026-02-27 13:57 ` [PATCH 1/4] scripts: Move lsan_suppressions.txt out of oss-fuzz subdir Peter Maydell
2026-02-27 15:04 ` Peter Maydell
2026-02-27 15:32 ` Yodel Eldar
2026-02-27 15:41 ` Peter Maydell
2026-02-27 13:57 ` [PATCH 2/4] scripts/lsan_suppressions.txt: Add more leaks Peter Maydell
2026-02-27 18:57 ` Fabiano Rosas
2026-02-27 19:10 ` Peter Maydell
2026-02-27 19:18 ` Fabiano Rosas
2026-02-27 13:57 ` [PATCH 3/4] hw/arm/aspeed_gpio: Don't leak string in aspeed_gpio_init() Peter Maydell
2026-02-27 22:22 ` Philippe Mathieu-Daudé
2026-02-28 6:33 ` Cédric Le Goater
2026-02-27 13:57 ` [PATCH 4/4] tests/qtest/iommu-smmuv3-test: Free QPCIDevice Peter Maydell
2026-02-27 19:13 ` Fabiano Rosas [this message]
2026-02-27 18:52 ` [PATCH 0/4] arm: Fix some memory leaks Fabiano Rosas
2026-02-27 19:01 ` Peter Maydell
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=87fr6m579t.fsf@suse.de \
--to=farosas@suse.de \
--cc=alex.bennee@linaro.org \
--cc=clg@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-arm@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.