[PATCHv2 04/10] tools: Fix resource leak closing sk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

---
 tools/avinfo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/avinfo.c b/tools/avinfo.c
index 7d58e25..d9f809b 100644
--- a/tools/avinfo.c
+++ b/tools/avinfo.c
@@ -583,6 +583,7 @@ static int l2cap_connect(bdaddr_t *src, bdaddr_t *dst)
 
 	if (bind(sk, (struct sockaddr *) &l2a, sizeof(l2a)) < 0) {
 		printf("Bind failed. %s (%d)\n", strerror(errno), errno);
+		close(sk);
 		return -errno;
 	}
 
@@ -593,6 +594,7 @@ static int l2cap_connect(bdaddr_t *src, bdaddr_t *dst)
 
 	if (connect(sk, (struct sockaddr *) &l2a, sizeof(l2a)) < 0) {
 		printf("Connect failed. %s(%d)\n", strerror(errno), errno);
+		close(sk);
 		return -errno;
 	}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux