From: Richard Levitte Date: Thu, 30 Jan 2003 21:49:16 +0000 (+0000) Subject: A few small bugs with BIO popping. X-Git-Tag: OpenSSL_0_9_7a~27 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8e1e238219aba2cd86bd8e5f175c233177ee18f8;p=oweals%2Fopenssl.git A few small bugs with BIO popping. PR: 364 --- diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 98ce395519..692c8fb5c6 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -395,6 +395,8 @@ BIO *BIO_pop(BIO *b) if (b == NULL) return(NULL); ret=b->next_bio; + BIO_ctrl(b,BIO_CTRL_POP,0,NULL); + if (b->prev_bio != NULL) b->prev_bio->next_bio=b->next_bio; if (b->next_bio != NULL) @@ -402,7 +404,6 @@ BIO *BIO_pop(BIO *b) b->next_bio=NULL; b->prev_bio=NULL; - BIO_ctrl(b,BIO_CTRL_POP,0,NULL); return(ret); } diff --git a/ssl/bio_ssl.c b/ssl/bio_ssl.c index 467e149947..1301549e21 100644 --- a/ssl/bio_ssl.c +++ b/ssl/bio_ssl.c @@ -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;