* [PATCH BlueZ] emulator: Free hooks in btdev_destroy
@ 2026-10-10 3:18 Iaroslav Voitovych
2026-10-10 9:42 ` [BlueZ] " bluez.test.bot
2026-10-12 21:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Iaroslav Voitovych @ 2026-10-10 3:18 UTC (permalink / raw)
To: linux-bluetooth
Hooks added with btdev_add_hook() are only freed by btdev_del_hook(),
so a hook still installed when the device is destroyed is leaked. Five
mgmt-tester cases leave one installed: "Add + Remove Device Nowait -
Success" and the four "Adv. (non-)connectable & connected" cases on the
LE emulator; one l2cap-tester case does too. They pass, but with ASan
the tester exits with status 1 because LeakSanitizer reports, for
mgmt-tester:
Direct leak of 120 byte(s) in 5 object(s) allocated from:
#0 in malloc
#1 in btdev_add_hook emulator/btdev.c:8891
Free the remaining hooks in btdev_destroy().
Fixes: 37199df506f4 ("emulator: Add support for pre/post command/event hooks")
---
emulator/btdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index e00f78288..ecc24a72b 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -8424,6 +8424,8 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
void btdev_destroy(struct btdev *btdev)
{
+ int i;
+
if (!btdev)
return;
@@ -8438,6 +8440,9 @@ void btdev_destroy(struct btdev *btdev)
queue_destroy(btdev->le_per_adv, free);
queue_destroy(btdev->le_big, le_big_free);
+ for (i = 0; i < MAX_HOOK_ENTRIES; i++)
+ free(btdev->hook_list[i]);
+
free(btdev);
}
base-commit: 7428ca2df9356363079db0f48412c20cbdb9471f
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [BlueZ] emulator: Free hooks in btdev_destroy
2026-10-10 3:18 [PATCH BlueZ] emulator: Free hooks in btdev_destroy Iaroslav Voitovych
@ 2026-10-10 9:42 ` bluez.test.bot
2026-10-12 21:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-10-10 9:42 UTC (permalink / raw)
To: linux-bluetooth, yaroslav.voytovych
[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1182787/
---Test result---
Test Summary:
CheckPatch PASS 0.34 seconds
GitLint PASS 0.24 seconds
BuildEll PASS 12.95 seconds
BluezMake PASS 194.01 seconds
CheckSmatch WARNING 169.06 seconds
bluezmakeextell PASS 58.40 seconds
TestFunctional PASS 830.17 seconds
IncrementalBuild PASS 202.99 seconds
ScanBuild PASS 572.28 seconds
Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
emulator/btdev.c:479:29: warning: Variable length array is used.
https://github.com/bluez/bluez/pull/2654
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ] emulator: Free hooks in btdev_destroy
2026-10-10 3:18 [PATCH BlueZ] emulator: Free hooks in btdev_destroy Iaroslav Voitovych
2026-10-10 9:42 ` [BlueZ] " bluez.test.bot
@ 2026-10-12 21:50 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-10-12 21:50 UTC (permalink / raw)
To: Iaroslav Voitovych; +Cc: linux-bluetooth
Hello:
This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sat, 10 Oct 2026 05:18:46 +0200 you wrote:
> Hooks added with btdev_add_hook() are only freed by btdev_del_hook(),
> so a hook still installed when the device is destroyed is leaked. Five
> mgmt-tester cases leave one installed: "Add + Remove Device Nowait -
> Success" and the four "Adv. (non-)connectable & connected" cases on the
> LE emulator; one l2cap-tester case does too. They pass, but with ASan
> the tester exits with status 1 because LeakSanitizer reports, for
> mgmt-tester:
>
> [...]
Here is the summary with links:
- [BlueZ] emulator: Free hooks in btdev_destroy
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8da7e648a9fb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-12 21:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10 3:18 [PATCH BlueZ] emulator: Free hooks in btdev_destroy Iaroslav Voitovych
2026-10-10 9:42 ` [BlueZ] " bluez.test.bot
2026-10-12 21:50 ` [PATCH BlueZ] " patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox