All of lore.kernel.org
 help / color / mirror / Atom feed
* [bluez/bluez] d1fe80: Fix memory leak when adding GATT Characteristic
@ 2025-08-12  8:27 Stanislavs Nilovs
  0 siblings, 0 replies; only message in thread
From: Stanislavs Nilovs @ 2025-08-12  8:27 UTC (permalink / raw)
  To: linux-bluetooth

  Branch: refs/heads/990407
  Home:   https://github.com/bluez/bluez
  Commit: d1fe804dfe11ad92da41d3cc9e98f7e204304c8e
      https://github.com/bluez/bluez/commit/d1fe804dfe11ad92da41d3cc9e98f7e204304c8e
  Author: Stanislavs Nilovs <valorcool@gmail.com>
  Date:   2025-08-12 (Tue, 12 Aug 2025)

  Changed paths:
    M src/shared/gatt-db.c

  Log Message:
  -----------
  Fix memory leak when adding GATT Characteristic

Commit 4465c577778d812702d752dfd2812e25a2f69b31 has fixed a segfault
which may occur during new GATT Characteristic insertion. However, the
cleanup exercise isn't done before returning.

Bluetoothd address sanitizer backtrace:
=================================================================
==88967==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 768 byte(s) in 6 object(s) allocated from:
    #0 0x768d1f8b3ec7 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x59f0cac1ea07 in util_malloc src/shared/util.c:46

Indirect leak of 576 byte(s) in 18 object(s) allocated from:
    #0 0x768d1f8b3ec7 in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x59f0cac1ea07 in util_malloc src/shared/util.c:46

Indirect leak of 114 byte(s) in 6 object(s) allocated from:
    #0 0x768d1f8b4097 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
    #1 0x59f0cac75d6c in new_attribute src/shared/gatt-db.c:222

SUMMARY: AddressSanitizer: 1458 byte(s) leaked in 30 allocation(s).

Additionally added an explicit check that current Characteristic handle
is not greater or equal to its value handle. If value handle is equal to
Characteristic handle, then second "new_attribute" allocation will
overwrite the pointer in service->attributes, which will also cause a
leak.



To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-12  8:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12  8:27 [bluez/bluez] d1fe80: Fix memory leak when adding GATT Characteristic Stanislavs Nilovs

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.