From: Alan T. DeKok Date: Tue, 26 Apr 2022 13:00:34 +0000 (-0400) Subject: fix locking. Helps with #4465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b4068e58db1b113a2ba84f939b87c46bed698cd;p=thirdparty%2Ffreeradius-server.git fix locking. Helps with #4465 --- diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index 7ce02a23d4c..fbdafef9f3c 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -135,13 +135,14 @@ static void coalesce(uint64_t final_stats[FR_RADIUS_CODE_MAX], rlm_stats_thread_ other = fr_dlist_next(&t->inst->list, other)) { int i; - pthread_mutex_lock(&other->mutex); - if (other == t) continue; tree = (fr_rb_tree_t **) (((uint8_t *) other) + tree_offset); + pthread_mutex_lock(&other->mutex); stats = fr_rb_find(*tree, mydata); + if (!stats) { + pthread_mutex_unlock(&other->mutex); continue; } memcpy(&local_stats, stats->stats, sizeof(stats->stats));