mirror of
https://github.com/transmission/transmission
synced 2025-02-22 06:00:41 +00:00
Avoid a descriptor leak when binding the IPv6 DHT socket fails.
This commit is contained in:
parent
1cd74312ba
commit
fe2fd2efcf
1 changed files with 3 additions and 1 deletions
|
@ -294,8 +294,10 @@ rebind_ipv6(tr_bool force)
|
||||||
sin6.sin6_port = htons(dht_port);
|
sin6.sin6_port = htons(dht_port);
|
||||||
rc = bind(s, (struct sockaddr*)&sin6, sizeof(sin6));
|
rc = bind(s, (struct sockaddr*)&sin6, sizeof(sin6));
|
||||||
|
|
||||||
if(rc < 0)
|
if(rc < 0) {
|
||||||
|
close(s);
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if(dht6_socket < 0) {
|
if(dht6_socket < 0) {
|
||||||
dht6_socket = s;
|
dht6_socket = s;
|
||||||
|
|
Loading…
Reference in a new issue