]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
try to shut up clang scan
authorAlan T. DeKok <aland@freeradius.org>
Wed, 29 Mar 2023 11:31:02 +0000 (20:31 +0900)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 29 Mar 2023 11:31:02 +0000 (20:31 +0900)
which assumes (a) this->type == DETAIL, followed by assuming that
(b) this->type != DETAIL

So it's not tracking things correctly as the listener isn't being
changed during all that.

src/main/process.c

index 35c6d9e7862fe60897ed617504723ba1775ee2a8..8902386460e69c25955347a93b92c0eb7e69bf85 100644 (file)
@@ -5413,7 +5413,7 @@ static int proxy_eol_cb(void *ctx, void *data)
 static void event_new_fd(rad_listen_t *this)
 {
        char buffer[1024];
-       listen_socket_t *sock;
+       listen_socket_t *sock = NULL;
 
        ASSERT_MASTER;
 
@@ -5424,6 +5424,8 @@ static void event_new_fd(rad_listen_t *this)
        if (this->type != RAD_LISTEN_DETAIL) {
                sock = this->data;
                rad_assert(sock != NULL);
+       } else {
+               rad_assert(!this->send_coa);
        }
 
        if (this->status == RAD_LISTEN_STATUS_INIT) {
@@ -5473,6 +5475,7 @@ static void event_new_fd(rad_listen_t *this)
                 */
                case RAD_LISTEN_PROXY:
 #ifdef WITH_TCP
+                       rad_assert(sock != NULL);
                        rad_assert((sock->proto == IPPROTO_UDP) || (sock->home != NULL));
 
                        /*
@@ -5742,6 +5745,7 @@ static void event_new_fd(rad_listen_t *this)
 #endif
                        ) {
                        home_server_t *home;
+                       sock = this->data;
 
                        home = sock->home;
                        if (!home || !home->limit.max_connections) {
@@ -5803,8 +5807,7 @@ static void event_new_fd(rad_listen_t *this)
                if (!spawn_flag) {
                        ASSERT_MASTER;
 
-                       if (this->type != RAD_LISTEN_DETAIL && sock->ev) {
-                               sock = this->data;
+                       if (this->type != RAD_LISTEN_DETAIL && sock && sock->ev) {
                                fr_event_delete(el, &sock->ev);
                        }
                        listen_free(&this);