Merge pull request #575 from katterjohn/listener-socket-leak

(chibi net): make-listener-socket: close the socket on error
This commit is contained in:
Alex Shinn 2019-09-23 16:52:48 +08:00 committed by GitHub
commit e2d43bceb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -90,6 +90,7 @@
((not sock) ((not sock)
(error "couldn't create socket for: " addrinfo)) (error "couldn't create socket for: " addrinfo))
((not (set-socket-option! sock level/socket socket-opt/reuseaddr 1)) ((not (set-socket-option! sock level/socket socket-opt/reuseaddr 1))
(close-file-descriptor sock)
(error "couldn't set the socket to be reusable" addrinfo)) (error "couldn't set the socket to be reusable" addrinfo))
((not (bind sock ((not (bind sock
(address-info-address addrinfo) (address-info-address addrinfo)