diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-03-07 22:45:58 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-16 10:17:33 +0100 |
commit | c5ebfcab713a82a1d46a51c8c2668c419425b387 (patch) | |
tree | ca8da99a90b24c37c37ce417ad02c1f35e1e1735 /crypto/x509/x509cset.c | |
parent | 592b6fb489c97be2b039ab671647aa58a472204a (diff) | |
download | openssl-c5ebfcab713a82a1d46a51c8c2668c419425b387.tar.gz |
Unify <TYPE>_up_ref methods signature and behaviour.
Add a status return value instead of void.
Add some sanity checks on reference counter value.
Update the docs.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/x509/x509cset.c')
-rw-r--r-- | crypto/x509/x509cset.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/x509/x509cset.c b/crypto/x509/x509cset.c index ab5f192a15..d8259254f0 100644 --- a/crypto/x509/x509cset.c +++ b/crypto/x509/x509cset.c @@ -132,10 +132,16 @@ int X509_CRL_sort(X509_CRL *c) return 1; } -void X509_CRL_up_ref(X509_CRL *crl) +int X509_CRL_up_ref(X509_CRL *crl) { int i; - CRYPTO_atomic_add(&crl->references, 1, &i, crl->lock); + + if (CRYPTO_atomic_add(&crl->references, 1, &i, crl->lock) <= 0) + return 0; + + REF_PRINT_COUNT("X509_CRL", crl); + REF_ASSERT_ISNT(i < 2); + return ((i > 1) ? 1 : 0); } long X509_CRL_get_version(X509_CRL *crl) |