]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Skip fr_assert() for static analysis (CID #1414423)
authorJames Jones <jejones3141@gmail.com>
Mon, 28 Aug 2023 15:44:37 +0000 (10:44 -0500)
committerAlan DeKok <aland@freeradius.org>
Mon, 28 Aug 2023 18:19:42 +0000 (14:19 -0400)
For static analysis, fr_assert() is plain assert...but otherwise,
for non-debugging versions, it just logs. That means that to
coverity, the mutex won't be unlocked, while in production it
will always be unlocked.

src/lib/server/pool.c

index 6dd714d57a6b25a0d3e009bc724abf5f2d941ec8..00b5fabd70ece1cefd3807edae976b659dca4d57 100644 (file)
@@ -306,7 +306,13 @@ static fr_pool_connection_t *connection_find(fr_pool_t *pool, void *conn)
                        fr_assert(pthread_equal(this->pthread_id, pthread_id) != 0);
 #endif
 
+#ifndef STATIC_ANALYZER
+                       /*
+                        *      For static analyzers, fr_assert() is assert(),
+                        *      changing semantics so the mutex is not released.
+                        */
                        fr_assert(this->in_use == true);
+#endif
                        return this;
                }
        }