From 5539da566e69bdc04d71fce6e2279c6836f2ad3b Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 28 Dec 2017 05:34:24 +0000 Subject: [PATCH] When bind fails, make sure we closed the socket we tried to bind the address to. CID: 978244 --- sbin/routed/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/routed/main.c b/sbin/routed/main.c index 45b15065304..c4f9e56065e 100644 --- a/sbin/routed/main.c +++ b/sbin/routed/main.c @@ -667,6 +667,7 @@ get_rip_sock(naddr addr, if (bind(s, (struct sockaddr *)&rsin, sizeof(rsin)) < 0) { if (serious) BADERR(errno != EADDRINUSE, "bind(rip_sock)"); + close(s); return -1; } fix_sock(s,"rip_sock");