A few small bugs with BIO popping.
[openssl.git] / ssl / bio_ssl.c
index 467e1499470efe906900e23ad9f1396378eb6758..1301549e21ff60b4e800bed41307ae8691a187b4 100644 (file)
@@ -403,6 +403,10 @@ static long ssl_ctrl(BIO *b, int cmd, long num, void *ptr)
                        {
                        BIO_free_all(ssl->wbio);
                        }
+               if (b->next_bio != NULL)
+                       {
+                       CRYPTO_add(&b->next_bio->references,1,CRYPTO_LOCK_BIO);
+                       }
                ssl->wbio=NULL;
                ssl->rbio=NULL;
                break;