public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v1] gatt-server: fix memory leak in bt_gatt_server_send_notification()
@ 2024-06-27 15:09 Roman Smirnov
  2024-06-27 16:40 ` [BlueZ,v1] " bluez.test.bot
  2024-06-27 18:31 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 3+ messages in thread
From: Roman Smirnov @ 2024-06-27 15:09 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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/shared/gatt-server.c b/src/shared/gatt-server.c
index 0e399ceb1..fb8819c70 100644
--- a/src/shared/gatt-server.c
+++ b/src/shared/gatt-server.c
@@ -1822,6 +1822,7 @@ bool bt_gatt_server_send_notification(struct bt_gatt_server *server,
 	return result;
 
 error:
+	free(data->pdu);
 	if (data)
 		free(data);
 
-- 
2.43.0


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

end of thread, other threads:[~2024-06-27 18:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-27 15:09 [PATCH BlueZ v1] gatt-server: fix memory leak in bt_gatt_server_send_notification() Roman Smirnov
2024-06-27 16:40 ` [BlueZ,v1] " bluez.test.bot
2024-06-27 18:31 ` [PATCH BlueZ v1] " Luiz Augusto von Dentz

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