[PATCH BlueZ 2/3] tools/tester: Fix fd leaks

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

 



tools/tester.h:314:3: leaked_handle: Handle variable "sk" going out of scope leaks the handle.
tools/l2cap-tester.c:1957:4: leaked_handle: Handle variable "sk" going out of scope leaks the handle.
---
 tools/l2cap-tester.c | 1 +
 tools/tester.h       | 1 +
 2 files changed, 2 insertions(+)

diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c
index c473c6cc6480..208772527c47 100644
--- a/tools/l2cap-tester.c
+++ b/tools/l2cap-tester.c
@@ -1954,6 +1954,7 @@ static int connect_socket(const uint8_t *client_bdaddr, GIOFunc connect_cb,
 			tester_print("Can't enable deferred setup: %s (%d)",
 						strerror(errno), errno);
 			tester_test_failed();
+			close(sk);
 			return -1;
 		}
 	}
diff --git a/tools/tester.h b/tools/tester.h
index 8964751102d0..9df600f900ad 100644
--- a/tools/tester.h
+++ b/tools/tester.h
@@ -334,6 +334,7 @@ static inline void test_ethtool_get_ts_info(unsigned int index, int proto,
 	if (ioctl(sk, SIOCETHTOOL, &ifr) == -1) {
 		tester_warn("SIOCETHTOOL failed");
 		tester_test_failed();
+		close(sk);
 		return;
 	}
 	close(sk);
-- 
2.50.1





[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