diff options
author | Pauli <paul.dale@oracle.com> | 2016-06-03 10:52:32 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-06-03 12:08:13 -0400 |
commit | 7d6df9e9150abc8e0d8f88b02159261e37eea167 (patch) | |
tree | 5fa9df333cc599985bc14c6ffe62663daaf35b91 /crypto | |
parent | b38c43f7bc474c369ed652b19360ec90458be516 (diff) | |
download | openssl-7d6df9e9150abc8e0d8f88b02159261e37eea167.tar.gz |
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 <levitte@openssl.org>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509v3/pcy_cache.c | 3 |
1 files changed, 3 insertions, 0 deletions
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; |