From: Lasse Dalegaard <dalegaard@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Lasse Dalegaard <dalegaard@gmail.com>
Subject: [PATCH v2] device: fix memory leak
Date: Fri, 9 Jan 2026 21:29:25 +0100 [thread overview]
Message-ID: <20260109202925.774809-2-dalegaard@gmail.com> (raw)
device_add_eir_uuids creates a list of added UUIDs, but it was never
freed.
This was found with LeakSanitizer from the following backtrace:
==764182==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x7f3c7db20cb5 in malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:67
#1 0x7f3c7d870afa in g_malloc (/usr/lib/libglib-2.0.so.0+0x65afa) (BuildId: 8b07c017773317c7341f72bb8ca4a7a78b323f37)
#2 0x7f3c7d88e31f in g_slist_append (/usr/lib/libglib-2.0.so.0+0x8331f) (BuildId: 8b07c017773317c7341f72bb8ca4a7a78b323f37)
#3 0x564fa6ad9153 in device_add_eir_uuids src/device.c:2451
#4 0x564fa6a6b2ec in btd_adapter_device_found src/adapter.c:7481
#5 0x564fa6a6c5cd in device_found_callback src/adapter.c:7607
#6 0x564fa6b9b73d in notify_handler src/shared/mgmt.c:337
#7 0x564fa6b91ad8 in queue_foreach src/shared/queue.c:207
#8 0x564fa6b9ba3f in process_notify src/shared/mgmt.c:349
#9 0x564fa6b9c899 in can_read_data src/shared/mgmt.c:409
...
---
src/device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/device.c b/src/device.c
index c8aaf042f..0842becde 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2453,6 +2453,7 @@ void device_add_eir_uuids(struct btd_device *dev, GSList *uuids)
}
device_probe_profiles(dev, added);
+ g_slist_free(added);
}
static void add_manufacturer_data(void *data, void *user_data)
--
2.52.0
next reply other threads:[~2026-01-09 20:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 20:29 Lasse Dalegaard [this message]
2026-01-09 20:29 ` [PATCH v2] gatt-client: prevent use-after-free when clients disconnect Lasse Dalegaard
2026-01-09 21:23 ` [v2] " bluez.test.bot
2026-01-09 22:40 ` [PATCH v2] " patchwork-bot+bluetooth
2026-01-09 21:25 ` [v2] device: fix memory leak bluez.test.bot
2026-01-09 22:40 ` [PATCH v2] " patchwork-bot+bluetooth
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=20260109202925.774809-2-dalegaard@gmail.com \
--to=dalegaard@gmail.com \
--cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox