diff mbox series

[BlueZ,v2,1/3] shared/csip: Fix memory leak

Message ID 20240603185312.162337-1-luiz.dentz@gmail.com (mailing list archive)
State Accepted
Commit 09e39a7d6dca8041f3723ee9020c54b94c0c8d47
Headers show
Series [BlueZ,v2,1/3] shared/csip: Fix memory leak | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Luiz Augusto von Dentz June 3, 2024, 6:53 p.m. UTC
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This fixes the following leak:

102 bytes in 6 blocks are definitely lost in loss record 660 of 909
   at 0x484282F: malloc (vg_replace_malloc.c:446)
   by 0x5A078B: util_malloc (util.c:46)
   by 0x649162: read_sirk (csip.c:485)
   by 0x5C74FA: read_cb (gatt-client.c:2713)
   by 0x5C4137: handle_rsp (att.c:880)
   by 0x5C4137: can_read_data (att.c:1072)
   by 0x65DDA4: watch_callback (io-glib.c:157)
   by 0x49656AB: ??? (in /usr/lib64/libglib-2.0.so.0.8000.2)
   by 0x49C6707: ??? (in /usr/lib64/libglib-2.0.so.0.8000.2)
   by 0x496B666: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.8000.2)
   by 0x65FE3D: mainloop_run (mainloop-glib.c:66)
   by 0x6605A3: mainloop_run_with_signal (mainloop-notify.c:188)
   by 0x31DEFA: main (main.c:1468)
---
 src/shared/csip.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

patchwork-bot+bluetooth@kernel.org June 3, 2024, 8:30 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Mon,  3 Jun 2024 14:53:10 -0400 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This fixes the following leak:
> 
> 102 bytes in 6 blocks are definitely lost in loss record 660 of 909
>    at 0x484282F: malloc (vg_replace_malloc.c:446)
>    by 0x5A078B: util_malloc (util.c:46)
>    by 0x649162: read_sirk (csip.c:485)
>    by 0x5C74FA: read_cb (gatt-client.c:2713)
>    by 0x5C4137: handle_rsp (att.c:880)
>    by 0x5C4137: can_read_data (att.c:1072)
>    by 0x65DDA4: watch_callback (io-glib.c:157)
>    by 0x49656AB: ??? (in /usr/lib64/libglib-2.0.so.0.8000.2)
>    by 0x49C6707: ??? (in /usr/lib64/libglib-2.0.so.0.8000.2)
>    by 0x496B666: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.8000.2)
>    by 0x65FE3D: mainloop_run (mainloop-glib.c:66)
>    by 0x6605A3: mainloop_run_with_signal (mainloop-notify.c:188)
>    by 0x31DEFA: main (main.c:1468)
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2,1/3] shared/csip: Fix memory leak
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=09e39a7d6dca
  - [BlueZ,v2,2/3] shared/gatt-db: Introduce gatt_db_clone
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=7e9816dd8c21
  - [BlueZ,v2,3/3] set: Attempt to use existing set gatt-db
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=cbe4144dea6f

You are awesome, thank you!
bluez.test.bot@gmail.com June 3, 2024, 9:36 p.m. UTC | #2
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=858380

---Test result---

Test Summary:
CheckPatch                    PASS      1.33 seconds
GitLint                       PASS      0.90 seconds
BuildEll                      PASS      25.26 seconds
BluezMake                     PASS      1737.95 seconds
MakeCheck                     PASS      13.43 seconds
MakeDistcheck                 PASS      183.16 seconds
CheckValgrind                 PASS      256.79 seconds
CheckSmatch                   PASS      361.66 seconds
bluezmakeextell               PASS      124.04 seconds
IncrementalBuild              PASS      4783.17 seconds
ScanBuild                     PASS      1055.55 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/src/shared/csip.c b/src/shared/csip.c
index e13efb6ce634..87b4590d926d 100644
--- a/src/shared/csip.c
+++ b/src/shared/csip.c
@@ -128,6 +128,15 @@  void bt_csip_detach(struct bt_csip *csip)
 	queue_foreach(csip_cbs, csip_detached, csip);
 }
 
+static void csis_free(struct bt_csis *csis)
+{
+	if (!csis)
+		return;
+
+	free(csis->sirk_val);
+	free(csis);
+}
+
 static void csip_db_free(void *data)
 {
 	struct bt_csip_db *cdb = data;
@@ -137,7 +146,7 @@  static void csip_db_free(void *data)
 
 	gatt_db_unref(cdb->db);
 
-	free(cdb->csis);
+	csis_free(cdb->csis);
 	free(cdb);
 }