diff mbox series

[BlueZ,v1] health/mcap: fix memory leak in mcap_create_mcl()

Message ID 20240627133222.82707-1-r.smirnov@omp.ru (mailing list archive)
State Accepted
Commit 2ebb415b12c48a727b106b6f28452cc430996964
Headers show
Series [BlueZ,v1] health/mcap: fix memory leak in mcap_create_mcl() | 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

Roman Smirnov June 27, 2024, 1:32 p.m. UTC
set_default_cb() can allocate memory for mcl->cb but it does
not free mcl->cb before exiting the function.

Add freeing mcl->cb before exiting the function.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
 profiles/health/mcap.c | 1 +
 1 file changed, 1 insertion(+)

Comments

bluez.test.bot@gmail.com June 27, 2024, 3:37 p.m. UTC | #1
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=866166

---Test result---

Test Summary:
CheckPatch                    PASS      0.44 seconds
GitLint                       PASS      0.47 seconds
BuildEll                      PASS      24.40 seconds
BluezMake                     PASS      1627.52 seconds
MakeCheck                     PASS      13.50 seconds
MakeDistcheck                 PASS      176.38 seconds
CheckValgrind                 PASS      251.58 seconds
CheckSmatch                   PASS      352.26 seconds
bluezmakeextell               PASS      119.01 seconds
IncrementalBuild              PASS      1385.19 seconds
ScanBuild                     PASS      994.03 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org June 27, 2024, 6:40 p.m. UTC | #2
Hello:

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

On Thu, 27 Jun 2024 16:32:21 +0300 you wrote:
> set_default_cb() can allocate memory for mcl->cb but it does
> not free mcl->cb before exiting the function.
> 
> Add freeing mcl->cb before exiting the function.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v1] health/mcap: fix memory leak in mcap_create_mcl()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=2ebb415b12c4

You are awesome, thank you!
diff mbox series

Patch

diff --git a/profiles/health/mcap.c b/profiles/health/mcap.c
index 5d2bac3d9..b544b9a0a 100644
--- a/profiles/health/mcap.c
+++ b/profiles/health/mcap.c
@@ -1907,6 +1907,7 @@  gboolean mcap_create_mcl(struct mcap_instance *mi,
 		set_default_cb(mcl);
 		if (util_getrandom(&val, sizeof(val), 0) < 0) {
 			mcap_instance_unref(mcl->mi);
+			g_free(mcl->cb);
 			g_free(mcl);
 			return FALSE;
 		}