summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/x509/pcy_map.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/x509/pcy_map.c b/crypto/x509/pcy_map.c
index b599ff9804..d129eca4c3 100644
--- a/crypto/x509/pcy_map.c
+++ b/crypto/x509/pcy_map.c
@@ -73,8 +73,10 @@ int ossl_policy_cache_set_mapping(X509 *x, POLICY_MAPPINGS *maps)
ret = 1;
bad_mapping:
- if (ret == -1)
+ if (ret == -1 && CRYPTO_THREAD_write_lock(x->lock)) {
x->ex_flags |= EXFLAG_INVALID_POLICY;
+ CRYPTO_THREAD_unlock(x->lock);
+ }
sk_POLICY_MAPPING_pop_free(maps, POLICY_MAPPING_free);
return ret;