Thread (2 messages) flat view 2 messages, 2 authors, 2017-03-28
STALE3452d

[PATCH BlueZ] tools: Fix the sock handle leak

From: <hidden>
Date: 2017-03-28 01:12:14
Subsystem: the rest · Maintainer: Linus Torvalds

From: Lee Hyuk <redacted>

This patch adds function "close" for fixing the socket handle leak.
---
 tools/rfcomm.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/tools/rfcomm.c b/tools/rfcomm.c
index 809c240..03359be 100644
--- a/tools/rfcomm.c
+++ b/tools/rfcomm.c
@@ -310,6 +310,7 @@ static void cmd_connect(int ctl, int dev, bdaddr_t *bdaddr, int argc, char **arg
 
 		if (setsockopt(sk, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0) {
 			perror("Can't set linger option");
+			close(sk);
 			return;
 		}
 	}
-- 
1.9.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help