Skip to contentSkip to conversation

device: Fix memory leak

PATCH Applied Frédéric Danis 3 participants 3 messages Jun 18, 2025 – Jun 19, 2025 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 device: Fix memory leak

This frees the LastUsedBearer string to avoid memory leak:

Direct leak of 12 byte(s) in 2 object(s) allocated from:

    #0 0x7ccf538fd9c7 in malloc ../../../../src/libsanitizer/asan/
						asan_malloc_linux.cpp:69
    #1 0x7ccf53665b09 in g_malloc (/lib/x86_64-linux-gnu/
						libglib-2.0.so.0+0x62b09)
    #2 0x7ccf53659b90  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x56b90)
    #3 0x7ccf53659cd4 in g_key_file_get_string (/lib/x86_64-linux-gnu/
						libglib-2.0.so.0+0x56cd4)
    #4 0x5c8c691f2811 in load_info src/device.c:4225
---
 src/device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
src/device.c +3 -1
index 902c4aa44..e4d5d79ee 100644
@@ -4224,10 +4224,12 @@ static void load_info(struct btd_device *device, const char *local,
 		/* Load last used bearer */
 		str = g_key_file_get_string(key_file, "General",
 						"LastUsedBearer", NULL);
-		if (str)
+		if (str) {
 			device_update_last_used(device, !strcmp(str, "le") ?
 						device->bdaddr_type :
 						BDADDR_BREDR);
+			g_free(str);
+		}
 	}
 
 next:
Signature · 1 line
2.43.0
#1 lore raw

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/project/bluetooth/list/?series=973494

---Test result---

Test Summary:

CheckPatch                    PENDING   0.33 seconds
GitLint                       PENDING   0.30 seconds
BuildEll                      PASS      20.22 seconds
BluezMake                     PASS      2661.90 seconds
MakeCheck                     PASS      20.30 seconds
MakeDistcheck                 PASS      200.75 seconds
CheckValgrind                 PASS      275.71 seconds
CheckSmatch                   PASS      304.32 seconds
bluezmakeextell               PASS      128.23 seconds
IncrementalBuild              PENDING   0.28 seconds
ScanBuild                     PASS      907.58 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Frédéric Danis
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 12 lines · On Wed, 18 Jun 2025 17:29:18 +0200 you wrote:

This frees the LastUsedBearer string to avoid memory leak:

Direct leak of 12 byte(s) in 2 object(s) allocated from:

    #0 0x7ccf538fd9c7 in malloc ../../../../src/libsanitizer/asan/
						asan_malloc_linux.cpp:69
    #1 0x7ccf53665b09 in g_malloc (/lib/x86_64-linux-gnu/
						libglib-2.0.so.0+0x62b09)
    #2 0x7ccf53659b90  (/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x56b90)
    #3 0x7ccf53659cd4 in g_key_file_get_string (/lib/x86_64-linux-gnu/
						libglib-2.0.so.0+0x56cd4)
    #4 0x5c8c691f2811 in load_info src/device.c:4225
Quoted 1 line

[...]

Here is the summary with links:
- [BlueZ] device: Fix memory leak

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=941dbc5f3b56

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html