l2cap-tester: Fix leaked_handle
authorGopal Tiwari <gtiwari@redhat.com>
Tue, 31 May 2022 07:41:11 +0000 (13:11 +0530)
committerAyush Garg <ayush.garg@samsung.com>
Mon, 15 May 2023 09:25:54 +0000 (14:55 +0530)
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: Manika Shrivastava <manika.sh@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
tools/l2cap-tester.c

index d78b1e2..3f04640 100755 (executable)
@@ -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;
        }