From 6696a40ea97df87bff520e23f38c65bde63237b0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 19 Nov 2018 12:27:56 +1100 Subject: [PATCH] address resource leak; don't call close() on socket error; --- lib/isc/unix/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index ff9efe535c..7e1c616afd 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -5453,7 +5453,6 @@ init_hasreuseport() { int sock, yes = 1; sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { - close(sock); return; } else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&yes, sizeof(yes)) < 0) @@ -5467,6 +5466,7 @@ init_hasreuseport() { return; } hasreuseport = true; + close(sock); #endif }