2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

address resource leak; don't call close() on socket error;

This commit is contained in:
Mark Andrews
2018-11-19 12:27:56 +11:00
parent 2eabc74547
commit 6696a40ea9

View File

@@ -5453,7 +5453,6 @@ init_hasreuseport() {
int sock, yes = 1; int sock, yes = 1;
sock = socket(AF_INET, SOCK_DGRAM, 0); sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) { if (sock < 0) {
close(sock);
return; return;
} else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, } else if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(void *)&yes, sizeof(yes)) < 0) (void *)&yes, sizeof(yes)) < 0)
@@ -5467,6 +5466,7 @@ init_hasreuseport() {
return; return;
} }
hasreuseport = true; hasreuseport = true;
close(sock);
#endif #endif
} }