From: James Jones Date: Mon, 28 Aug 2023 15:44:37 +0000 (-0500) Subject: Skip fr_assert() for static analysis (CID #1414423) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28aae6fc257004cb24473934657436466d59dd22;p=thirdparty%2Ffreeradius-server.git Skip fr_assert() for static analysis (CID #1414423) 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. --- diff --git a/src/lib/server/pool.c b/src/lib/server/pool.c index 6dd714d57a6..00b5fabd70e 100644 --- a/src/lib/server/pool.c +++ b/src/lib/server/pool.c @@ -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; } }