2013-12-12 07:48:28

by Andrei Emeltchenko

[permalink] [raw]
Subject: [PATCH] l2cap-tester: Close sk in error path

From: Andrei Emeltchenko <[email protected]>

This fixes resource leak warnings.
---
tools/l2cap-tester.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index 505ac79..e4dade2 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -503,6 +503,7 @@ static int create_l2cap_sock(struct test_data *data, uint16_t psm)
master_bdaddr = hciemu_get_master_bdaddr(data->hciemu);
if (!master_bdaddr) {
tester_warn("No master bdaddr");
+ close(sk);
return -ENODEV;
}

@@ -701,6 +702,7 @@ static void test_server(const void *test_data)
tester_warn("listening on socket failed: %s (%u)",
strerror(errno), errno);
tester_test_failed();
+ close(sk);
return;
}

--
1.8.3.2



2013-12-12 07:57:34

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH] l2cap-tester: Close sk in error path

Hi Andrei,

On Thu, Dec 12, 2013, Andrei Emeltchenko wrote:
> This fixes resource leak warnings.
> ---
> tools/l2cap-tester.c | 2 ++
> 1 file changed, 2 insertions(+)

Applied. Thanks.

Johan