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/dh | |
parent | 7823d792d0cad3b44ad5389a8d3381becefe7f44 (diff) | |
download | openssl-f3f1cf8444f439c0be9de04bf3821a20d00fd956.tar.gz |
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/dh')
-rw-r--r-- | crypto/dh/dh_lib.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 013008eafe..9167d69ea8 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -157,17 +157,10 @@ void DH_free(DH *r) if (r == NULL) return; i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_DH); -#ifdef REF_PRINT - REF_PRINT("DH", r); -#endif + REF_PRINT_COUNT("DH", r); if (i > 0) return; -#ifdef REF_CHECK - if (i < 0) { - fprintf(stderr, "DH_free, bad reference count\n"); - abort(); - } -#endif + REF_ASSERT_ISNT(i < 0); if (r->meth->finish) r->meth->finish(r); @@ -192,15 +185,9 @@ void DH_free(DH *r) int DH_up_ref(DH *r) { int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_DH); -#ifdef REF_PRINT - REF_PRINT("DH", r); -#endif -#ifdef REF_CHECK - if (i < 2) { - fprintf(stderr, "DH_up, bad reference count\n"); - abort(); - } -#endif + + REF_PRINT_COUNT("DH", r); + REF_ASSERT_ISNT(i < 2); return ((i > 1) ? 1 : 0); } |