]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
push increment until after any failure. Fixes #5458
authorAlan T. DeKok <aland@freeradius.org>
Wed, 6 Nov 2024 14:20:35 +0000 (14:20 +0000)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 6 Nov 2024 14:21:42 +0000 (14:21 +0000)
src/main/listen.c

index c313e0233c8cbd20e4db5daea847648914722019..9644da1f5d3146649ba59280144071612dda8d72 100644 (file)
@@ -922,8 +922,6 @@ static int dual_tcp_accept(rad_listen_t *listener)
                close(newfd);
                return 0;
        }
-       client->limit.num_connections++;
-       sock->limit.num_connections++;
 
        /*
         *      Add the new listener.  We require a new context here,
@@ -933,6 +931,12 @@ static int dual_tcp_accept(rad_listen_t *listener)
        this = listen_alloc(NULL, listener->type);
        if (!this) return -1;
 
+       /*
+        *      Now that we've opened a connection, increment the reference count.
+        */
+       client->limit.num_connections++;
+       sock->limit.num_connections++;
+
        /*
         *      Copy everything, including the pointer to the socket
         *      information.