From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] l2cap-tester: Close sk in error path
Date: Thu, 12 Dec 2013 09:48:28 +0200 [thread overview]
Message-ID: <1386834508-9929-1-git-send-email-Andrei.Emeltchenko.news@gmail.com> (raw)
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
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
next reply other threads:[~2013-12-12 7:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 7:48 Andrei Emeltchenko [this message]
2013-12-12 7:57 ` [PATCH] l2cap-tester: Close sk in error path Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1386834508-9929-1-git-send-email-Andrei.Emeltchenko.news@gmail.com \
--to=andrei.emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).