[PATCH] selftests/net: missing close function in randomize function

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

 



in randomize function, there is a open function, but there is no
close function in the randomize, which is easy to cause memory leaks.

Signed-off-by: Liu Jing <liujing@xxxxxxxxxxxxxxxxxxxx>
---
 tools/testing/selftests/net/tcp_mmap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/net/tcp_mmap.c b/tools/testing/selftests/net/tcp_mmap.c
index 4fcce5150850..ab305e262d0a 100644
--- a/tools/testing/selftests/net/tcp_mmap.c
+++ b/tools/testing/selftests/net/tcp_mmap.c
@@ -438,6 +438,7 @@ static void randomize(void *target, size_t count)
 		perror("read /dev/urandom");
 		exit(1);
 	}
+	close(urandom);
 }
 
 int main(int argc, char *argv[])
-- 
2.33.0







[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux