]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
close socket on error. CID #1419878
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 Oct 2017 19:52:11 +0000 (15:52 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 19 Oct 2017 19:52:11 +0000 (15:52 -0400)
src/lib/util/socket.c

index f98efc56c784137336d63fb3d6abe6a712d9769c..9473bca40b86d14fae50c65c77c2876aec67907a 100644 (file)
@@ -443,7 +443,10 @@ int fr_socket_client_udp(fr_ipaddr_t *src_ipaddr, uint16_t *src_port, fr_ipaddr_
                if (!src_ipaddr) src_ipaddr = &my_ipaddr;
                if (!src_port) src_port = &my_port;
 
-               if (fr_ipaddr_from_sockaddr(&salocal, salen, src_ipaddr, src_port) < 0) return -1;
+               if (fr_ipaddr_from_sockaddr(&salocal, salen, src_ipaddr, src_port) < 0) {
+                       close(sockfd);
+                       return -1;
+               }
        }
 
        /*