From 9bde6aeb76b1d2a45d76637553c3fb3f31e4ecbd Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Mon, 13 Apr 2015 11:04:03 -0700 Subject: [PATCH] bio: remove reference count. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It appears that this reference “count” is set to one at creation and never touched after that. Change-Id: I3238a6d3dd702953771b8ec725c1c5712c648fba Reviewed-on: https://boringssl-review.googlesource.com/4320 Reviewed-by: Adam Langley --- crypto/bio/bio.c | 6 ------ include/openssl/bio.h | 5 +---- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c index 4a077623..be3cc215 100644 --- a/crypto/bio/bio.c +++ b/crypto/bio/bio.c @@ -75,7 +75,6 @@ static int bio_set(BIO *bio, const BIO_METHOD *method) { bio->method = method; bio->shutdown = 1; - bio->references = 1; if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data)) { return 0; @@ -110,11 +109,6 @@ int BIO_free(BIO *bio) { BIO *next_bio; for (; bio != NULL; bio = next_bio) { - int refs = CRYPTO_add(&bio->references, -1, CRYPTO_LOCK_BIO); - if (refs > 0) { - return 0; - } - if (bio->callback != NULL) { int i = (int)bio->callback(bio, BIO_CB_FREE, NULL, 0, 0, 1); if (i <= 0) { diff --git a/include/openssl/bio.h b/include/openssl/bio.h index 6ce25bb7..7b5232cb 100644 --- a/include/openssl/bio.h +++ b/include/openssl/bio.h @@ -783,10 +783,7 @@ struct bio_st { /* num is a BIO-specific value. For example, in fd BIOs it's used to store a * file descriptor. */ int num; - /* TODO(fork): reference counting is only used by the SSL BIO code. If we can - * dump that then we can remove this. We could also drop - * BIO_CTRL_PUSH/BIO_CTRL_POP. */ - int references; + /* TODO(fork): drop BIO_CTRL_PUSH/BIO_CTRL_POP. */ void *ptr; /* next_bio points to the next |BIO| in a chain. This |BIO| owns a reference * to |next_bio|. */