From a28da66990ca13884f7862683cdc091f79509e42 Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Sun, 22 Sep 2019 19:18:18 -0500 Subject: [PATCH] (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.) --- lib/chibi/net.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/chibi/net.scm b/lib/chibi/net.scm index 4399c92d..7d92d1ef 100644 --- a/lib/chibi/net.scm +++ b/lib/chibi/net.scm @@ -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)