(chibi net): make-listener-socket: close the socket on error

A socket was leaked in the case where setting socket-opt/reuseaddr
failed.  (The socket was closed in the cases where bind or listen
failed.)
This commit is contained in:
Kris Katterjohn 2019-09-22 19:18:18 -05:00
parent 144581b834
commit a28da66990

View file

@ -90,6 +90,7 @@
((not sock)
(error "couldn't create socket for: " addrinfo))
((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))
((not (bind sock
(address-info-address addrinfo)