public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] gatt-server: fix memory leak in bt_gatt_server_send_notification()
@ 2024-06-28  7:57 Roman Smirnov
  2024-06-28  9:47 ` [BlueZ,v2] " bluez.test.bot
  2024-06-28 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-28  7:57 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Roman Smirnov

data-pdu is allocated but not released when an error occurs.

Add data-pdu release before exiting the function in case of an error.

Found by Linux Verification Center (linuxtesting.org) with the SVACE
static analysis tool.
---
 src/shared/gatt-server.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index 0e399ceb1..3a53d5dfd 100644
--- a/src/shared/gatt-server.c
+++ b/src/shared/gatt-server.c
@@ -1822,8 +1822,10 @@ bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
 	return result;
 
 error:
-	if (data)
+	if (data) {
+		free(data->pdu);
 		free(data);
+	}
 
 	return false;
 }
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,v2] gatt-server: fix memory leak in bt_gatt_server_send_notification()
  2024-06-28  7:57 [PATCH BlueZ v2] gatt-server: fix memory leak in bt_gatt_server_send_notification() Roman Smirnov
@ 2024-06-28  9:47 ` bluez.test.bot
  2024-06-28 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-06-28  9:47 UTC (permalink / raw)
  To: linux-bluetooth, r.smirnov

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

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=866451

---Test result---

Test Summary:
CheckPatch                    PASS      0.26 seconds
GitLint                       PASS      0.20 seconds
BuildEll                      PASS      25.21 seconds
BluezMake                     PASS      1761.46 seconds
MakeCheck                     PASS      13.72 seconds
MakeDistcheck                 PASS      191.98 seconds
CheckValgrind                 PASS      263.42 seconds
CheckSmatch                   WARNING   365.33 seconds
bluezmakeextell               PASS      125.57 seconds
IncrementalBuild              PASS      1546.59 seconds
ScanBuild                     PASS      1033.94 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/gatt-server.c:278:25: warning: Variable length array is used.src/shared/gatt-server.c:621:25: warning: Variable length array is used.src/shared/gatt-server.c:720:25: warning: Variable length array is used.src/shared/gatt-server.c:278:25: warning: Variable length array is used.src/shared/gatt-server.c:621:25: warning: Variable length array is used.src/shared/gatt-server.c:720:25: warning: Variable length array is used.src/shared/gatt-server.c:278:25: warning: Variable length array is used.src/shared/gatt-server.c:621:25: warning: Variable length array is used.src/shared/gatt-server.c:720:25: warning: Variable length array is used.


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] gatt-server: fix memory leak in bt_gatt_server_send_notification()
  2024-06-28  7:57 [PATCH BlueZ v2] gatt-server: fix memory leak in bt_gatt_server_send_notification() Roman Smirnov
  2024-06-28  9:47 ` [BlueZ,v2] " bluez.test.bot
@ 2024-06-28 15:10 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2024-06-28 15:10 UTC (permalink / raw)
  To: Roman Smirnov; +Cc: linux-bluetooth

Hello:

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

On Fri, 28 Jun 2024 10:57:18 +0300 you wrote:
> data-pdu is allocated but not released when an error occurs.
> 
> Add data-pdu release before exiting the function in case of an error.
> 
> Found by Linux Verification Center (linuxtesting.org) with the SVACE
> static analysis tool.
> 
> [...]

Here is the summary with links:
  - [BlueZ,v2] gatt-server: fix memory leak in bt_gatt_server_send_notification()
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0ddcfaeafad6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-28 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28  7:57 [PATCH BlueZ v2] gatt-server: fix memory leak in bt_gatt_server_send_notification() Roman Smirnov
2024-06-28  9:47 ` [BlueZ,v2] " bluez.test.bot
2024-06-28 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox