From: Pauli Date: Fri, 3 Jun 2016 14:52:32 +0000 (-0400) Subject: Fix threading issue that at best will leak memory X-Git-Tag: OpenSSL_1_1_0-pre6~584 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7d6df9e9150abc8e0d8f88b02159261e37eea167;p=oweals%2Fopenssl.git Fix threading issue that at best will leak memory The problem is the checking in policy_cache_set, there is a race condition between the null check and obtaining the lock. The fix is in policy_cache_new to detect if the creation has happened already. Reviewed-by: Richard Levitte --- diff --git a/crypto/x509v3/pcy_cache.c b/crypto/x509v3/pcy_cache.c index e254142c0f..a9ee30a8d9 100644 --- a/crypto/x509v3/pcy_cache.c +++ b/crypto/x509v3/pcy_cache.c @@ -78,6 +78,9 @@ static int policy_cache_new(X509 *x) CERTIFICATEPOLICIES *ext_cpols = NULL; POLICY_MAPPINGS *ext_pmaps = NULL; int i; + + if (x->policy_cache != NULL) + return 1; cache = OPENSSL_malloc(sizeof(*cache)); if (cache == NULL) return 0;