diff mbox series

[Bluez,V2,07/13] Fixing leaked_handle in l2cap-tester.c

Message ID 20220531074117.610321-8-gopalkrishna.tiwari@gmail.com
State Superseded
Headers show
Series Fixing memory leak, leaked_handle and use_after | expand

Commit Message

Gopal Tiwari May 31, 2022, 7:41 a.m. UTC
From: Gopal Tiwari <gtiwari@redhat.com>

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 <gtiwari@redhat.com>
---
 tools/l2cap-tester.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;
 	}