Free an ASN1_OBJECT in an error path
[openssl.git] / crypto / x509v3 / pcy_cache.c
index 41a748d872d8753a8a251cad13a64dcff969a137..bdce5a83bbd57ad7f7dc40d98d90612131287f91 100644 (file)
@@ -1,4 +1,3 @@
-/* pcy_cache.c */
 /*
  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
  * 2004.
@@ -84,12 +83,12 @@ static int policy_cache_create(X509 *x,
     if (sk_POLICYINFO_num(policies) == 0)
         goto bad_policy;
     cache->data = sk_X509_POLICY_DATA_new(policy_data_cmp);
-    if (!cache->data)
+    if (cache->data == NULL)
         goto bad_policy;
     for (i = 0; i < sk_POLICYINFO_num(policies); i++) {
         policy = sk_POLICYINFO_value(policies, i);
         data = policy_data_new(policy, NULL, crit);
-        if (!data)
+        if (data == NULL)
             goto bad_policy;
         /*
          * Duplicate policy OIDs are illegal: reject if matches found.
@@ -129,7 +128,7 @@ static int policy_cache_new(X509 *x)
     POLICY_MAPPINGS *ext_pmaps = NULL;
     int i;
     cache = OPENSSL_malloc(sizeof(*cache));
-    if (!cache)
+    if (cache == NULL)
         return 0;
     cache->anyPolicy = NULL;
     cache->data = NULL;
@@ -225,9 +224,9 @@ const X509_POLICY_CACHE *policy_cache_set(X509 *x)
 {
 
     if (x->policy_cache == NULL) {
-        CRYPTO_w_lock(CRYPTO_LOCK_X509);
+        CRYPTO_THREAD_write_lock(x->lock);
         policy_cache_new(x);
-        CRYPTO_w_unlock(CRYPTO_LOCK_X509);
+        CRYPTO_THREAD_unlock(x->lock);
     }
 
     return x->policy_cache;