diff options
Diffstat (limited to 'src/lib/libssl/bio_ssl.c')
| -rw-r--r-- | src/lib/libssl/bio_ssl.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/lib/libssl/bio_ssl.c b/src/lib/libssl/bio_ssl.c index af319af302..420deb7fc9 100644 --- a/src/lib/libssl/bio_ssl.c +++ b/src/lib/libssl/bio_ssl.c | |||
| @@ -398,19 +398,17 @@ static long ssl_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 398 | } | 398 | } |
| 399 | break; | 399 | break; |
| 400 | case BIO_CTRL_POP: | 400 | case BIO_CTRL_POP: |
| 401 | /* Only detach if we are the BIO explicitly being popped */ | 401 | /* ugly bit of a hack */ |
| 402 | if (b == ptr) | 402 | if (ssl->rbio != ssl->wbio) /* we are in trouble :-( */ |
| 403 | { | 403 | { |
| 404 | /* Shouldn't happen in practice because the | 404 | BIO_free_all(ssl->wbio); |
| 405 | * rbio and wbio are the same when pushed. | 405 | } |
| 406 | */ | 406 | if (b->next_bio != NULL) |
| 407 | if (ssl->rbio != ssl->wbio) | 407 | { |
| 408 | BIO_free_all(ssl->wbio); | 408 | CRYPTO_add(&b->next_bio->references,1,CRYPTO_LOCK_BIO); |
| 409 | if (b->next_bio != NULL) | ||
| 410 | CRYPTO_add(&b->next_bio->references,-1,CRYPTO_LOCK_BIO); | ||
| 411 | ssl->wbio=NULL; | ||
| 412 | ssl->rbio=NULL; | ||
| 413 | } | 409 | } |
| 410 | ssl->wbio=NULL; | ||
| 411 | ssl->rbio=NULL; | ||
| 414 | break; | 412 | break; |
| 415 | case BIO_C_DO_STATE_MACHINE: | 413 | case BIO_C_DO_STATE_MACHINE: |
| 416 | BIO_clear_retry_flags(b); | 414 | BIO_clear_retry_flags(b); |
| @@ -545,6 +543,7 @@ BIO *BIO_new_ssl_connect(SSL_CTX *ctx) | |||
| 545 | return(ret); | 543 | return(ret); |
| 546 | err: | 544 | err: |
| 547 | if (con != NULL) BIO_free(con); | 545 | if (con != NULL) BIO_free(con); |
| 546 | if (ret != NULL) BIO_free(ret); | ||
| 548 | return(NULL); | 547 | return(NULL); |
| 549 | } | 548 | } |
| 550 | 549 | ||
