]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
#ifdef protect key_mutex
authorMark Andrews <marka@isc.org>
Wed, 2 Dec 2020 08:51:35 +0000 (19:51 +1100)
committerMark Andrews <marka@isc.org>
Thu, 10 Dec 2020 02:34:36 +0000 (02:34 +0000)
lib/dns/geoip2.c

index 1e58f051b2fdc338fb1f8c7d82708fa9370168eb..9ba7f1a3b19ab43ba42ccbd4c15c2e0d5ff84beb 100644 (file)
@@ -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;