2022-05-30 08:53:47

by Gopal Tiwari

[permalink] [raw]
Subject: [Bluez 07/13] Fixing leaked_handle in l2cap-tester.c

From: Gopal Tiwari <[email protected]>

While performing static tool analysis using coverity found following reports for resouse leak

bluez-5.64/tools/l2cap-tester.c:1712: leaked_handle: Handle variable "new_sk" going out of scope leaks the handle.

Signed-off-by: Gopal Tiwari <[email protected]>
---
tools/l2cap-tester.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index d78b1e29c..3f0464013 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1709,6 +1709,7 @@ static gboolean l2cap_listen_cb(GIOChannel *io, GIOCondition cond,

if (!check_mtu(data, new_sk)) {
tester_test_failed();
+ close(new_sk);
return FALSE;
}

--
2.26.2