bio: remove reference count.

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 <agl@google.com>
diff --git a/crypto/bio/bio.c b/crypto/bio/bio.c
index 4a07762..be3cc21 100644
--- a/crypto/bio/bio.c
+++ b/crypto/bio/bio.c
@@ -75,7 +75,6 @@
 
   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 @@
   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 6ce25bb..7b5232c 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -783,10 +783,7 @@
   /* 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|. */