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-Tag: release_3_0_24~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7865d3f92b8d238a614738bc1c797918fb68d2bd;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 f6b61103d3a..38993dc44a9 100644 --- a/src/main/listen.c +++ b/src/main/listen.c @@ -3800,7 +3800,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); @@ -3816,6 +3815,8 @@ retry: tries++; return; } + + (void) pthread_mutex_init(&coa_key->mutex, NULL); } this->key = coa_key->key; /* no reason to duplicate the key */