diff options
author | Adam Langley <agl@google.com> | 2015-05-05 20:27:54 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-05-05 21:30:03 +0300 |
commit | 517da2f1efc91b179dfb1898f826b18a6a38f547 (patch) | |
tree | b8c69fd3f4c035570b0307e357e0d87084522871 /crypto/bio | |
parent | e60e2a483b3153f2de462371713cbf16e2764541 (diff) |
Add |BIO_up_ref| and |EVP_PKEY_up_ref|.
This avoids callers having to worry about |CRYPTO_add| and what the
correct lock to use it with is. (Esp since we'll probably change the way
that reference counts work in the future.)
Change-Id: I972bf0cc3be6099e0255e64a0fd50249062d1eb4
Reviewed-on: https://boringssl-review.googlesource.com/4623
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c index 2fcad6cc..48c1466d 100644 --- a/crypto/bio/bio.c +++ b/crypto/bio/bio.c @@ -126,6 +126,11 @@ int BIO_free(BIO *bio) { return 1; } +BIO *BIO_up_ref(BIO *bio) { + CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO); + return bio; +} + void BIO_vfree(BIO *bio) { BIO_free(bio); } |