Commit 1634592c authored by Mark Andrews's avatar Mark Andrews
Browse files

Merge branch '705-negative-value-passed-to-close-on-socket-c-and-resource-leak' into 'master'

Resolve "negative value passed to close on socket.c and resource leak"

Closes #705

See merge request !1095
parents 2eabc745 6696a40e
Pipeline #7165 passed with stages
in 23 minutes and 1 second
...@@ -5453,7 +5453,6 @@ init_hasreuseport() { ...@@ -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() { ...@@ -5467,6 +5466,7 @@ init_hasreuseport() {
return; return;
} }
hasreuseport = true; hasreuseport = true;
close(sock);
#endif #endif
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment