summaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_set.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/x509/x509_set.c')
-rw-r--r--crypto/x509/x509_set.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/x509/x509_set.c b/crypto/x509/x509_set.c
index 360ead87d3..59a6b29f89 100644
--- a/crypto/x509/x509_set.c
+++ b/crypto/x509/x509_set.c
@@ -146,10 +146,16 @@ int X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
return (X509_PUBKEY_set(&(x->cert_info.key), pkey));
}
-void X509_up_ref(X509 *x)
+int X509_up_ref(X509 *x)
{
int i;
- CRYPTO_atomic_add(&x->references, 1, &i, x->lock);
+
+ if (CRYPTO_atomic_add(&x->references, 1, &i, x->lock) <= 0)
+ return 0;
+
+ REF_PRINT_COUNT("X509", x);
+ REF_ASSERT_ISNT(i < 2);
+ return ((i > 1) ? 1 : 0);
}
long X509_get_version(X509 *x)