diff options
author | Rich Salz <rsalz@akamai.com> | 2016-01-30 12:04:25 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-11 12:40:32 -0500 |
commit | f3f1cf8444f439c0be9de04bf3821a20d00fd956 (patch) | |
tree | 50d0fc624d4680e6cd734328126cd60a9dc128be /crypto/asn1 | |
parent | 7823d792d0cad3b44ad5389a8d3381becefe7f44 (diff) |
Move to REF_DEBUG, for consistency.
Add utility macros REF_ASSERT_NOT and REF_PRINT_COUNT
This is also RT 4181
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/tasn_utl.c | 7 | ||||
-rw-r--r-- | crypto/asn1/x_info.c | 11 | ||||
-rw-r--r-- | crypto/asn1/x_pkey.c | 11 |
3 files changed, 6 insertions, 23 deletions
diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c index f1807c20f4..51f22aa7c6 100644 --- a/crypto/asn1/tasn_utl.c +++ b/crypto/asn1/tasn_utl.c @@ -118,12 +118,9 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) } ret = CRYPTO_add(lck, op, aux->ref_lock); #ifdef REF_PRINT - fprintf(stderr, "%s: Reference Count: %d\n", it->sname, *lck); -#endif -#ifdef REF_CHECK - if (ret < 0) - fprintf(stderr, "%s, bad reference count\n", it->sname); + fprintf(stderr, "%p:%4d:%s\n", it, *lck, it->sname); #endif + REF_ASSERT_ISNT(ret < 0); return ret; } diff --git a/crypto/asn1/x_info.c b/crypto/asn1/x_info.c index 375e0ae8bd..adee224699 100644 --- a/crypto/asn1/x_info.c +++ b/crypto/asn1/x_info.c @@ -82,17 +82,10 @@ void X509_INFO_free(X509_INFO *x) return; i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_INFO); -#ifdef REF_PRINT - REF_PRINT("X509_INFO", x); -#endif + REF_PRINT_COUNT("X509_INFO", x); if (i > 0) return; -#ifdef REF_CHECK - if (i < 0) { - fprintf(stderr, "X509_INFO_free, bad reference count\n"); - abort(); - } -#endif + REF_ASSERT_ISNT(i < 0); X509_free(x->x509); X509_CRL_free(x->crl); diff --git a/crypto/asn1/x_pkey.c b/crypto/asn1/x_pkey.c index 5bca68ad1e..6e09d29239 100644 --- a/crypto/asn1/x_pkey.c +++ b/crypto/asn1/x_pkey.c @@ -90,17 +90,10 @@ void X509_PKEY_free(X509_PKEY *x) return; i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_X509_PKEY); -#ifdef REF_PRINT - REF_PRINT("X509_PKEY", x); -#endif + REF_PRINT_COUNT("X509_PKEY", x); if (i > 0) return; -#ifdef REF_CHECK - if (i < 0) { - fprintf(stderr, "X509_PKEY_free, bad reference count\n"); - abort(); - } -#endif + REF_ASSERT_ISNT(i < 0); X509_ALGOR_free(x->enc_algor); ASN1_OCTET_STRING_free(x->enc_pkey); |