From: Alan T. DeKok Date: Sat, 3 Apr 2021 13:21:15 +0000 (-0400) Subject: only initialize the mutex if we succeed on insert X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed553f0970fc66e205fee7ad68a1360113e33e1d;p=thirdparty%2Ffreeradius-server.git only initialize the mutex if we succeed on insert on the off chance that pthread_mutex_init() allocates memory --- diff --git a/src/main/listen.c b/src/main/listen.c index 68aca8bd96..3919354aeb 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -3763,7 +3763,6 @@ retry: talloc_free(coa_key); return; } - (void) pthread_mutex_init(&coa_key->mutex, NULL); if (!rbtree_insert(coa_tree, coa_key)) { talloc_free(coa_key); @@ -3779,6 +3778,8 @@ retry: tries++; return; } + + (void) pthread_mutex_init(&coa_key->mutex, NULL); } this->key = coa_key->key; /* no reason to duplicate the key */