From: Mark Andrews Date: Wed, 2 Dec 2020 08:51:35 +0000 (+1100) Subject: #ifdef protect key_mutex X-Git-Tag: v9.11.27~9^2~3 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=136804b1a0e7c674dea6a2babf6e964b537fa0e5;p=thirdparty%2Fbind9.git #ifdef protect key_mutex --- diff --git a/lib/dns/geoip2.c b/lib/dns/geoip2.c index 1e58f051b2f..9ba7f1a3b19 100644 --- a/lib/dns/geoip2.c +++ b/lib/dns/geoip2.c @@ -192,10 +192,14 @@ set_state(const MMDB_s *db, const isc_netaddr_t *addr, state = saved_state; #endif if (state == NULL) { +#ifdef ISC_PLATFORM_USETHREADS LOCK(&key_mutex); +#endif state = (geoip_state_t *) isc_mem_get(state_mctx, sizeof(geoip_state_t)); +#ifdef ISC_PLATFORM_USETHREADS UNLOCK(&key_mutex); +#endif if (state == NULL) { return (ISC_R_NOMEMORY); } @@ -213,9 +217,13 @@ set_state(const MMDB_s *db, const isc_netaddr_t *addr, saved_state = state; #endif +#ifdef ISC_PLATFORM_USETHREADS LOCK(&key_mutex); +#endif isc_mem_attach(state_mctx, &state->mctx); +#ifdef ISC_PLATFORM_USETHREADS UNLOCK(&key_mutex); +#endif } state->db = db;