diff options
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bss_acpt.c | 1 | ||||
-rw-r--r-- | crypto/bio/bss_mem.c | 28 |
2 files changed, 12 insertions, 17 deletions
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c index f795b89145..e49c7ce5ea 100644 --- a/crypto/bio/bss_acpt.c +++ b/crypto/bio/bss_acpt.c @@ -450,7 +450,6 @@ static long acpt_ctrl(BIO *b, int cmd, long num, void *ptr) data->accepted_mode &= ~BIO_SOCK_NONBLOCK; break; case BIO_C_SET_FD: - b->init = 1; b->num = *((int *)ptr); data->accept_sock = b->num; data->state = ACPT_S_ACCEPT; diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index 621472594a..a50d416f2d 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -147,23 +147,19 @@ static int mem_buf_free(BIO *a, int free_all) { if (a == NULL) return 0; - if (a->shutdown) { - if ((a->init) && (a->ptr != NULL)) { - BUF_MEM *b; - BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr; - - if (bb != NULL) { - b = bb->buf; - if (a->flags & BIO_FLAGS_MEM_RDONLY) - b->data = NULL; - BUF_MEM_free(b); - if (free_all) { - OPENSSL_free(bb->readp); - OPENSSL_free(bb); - } - } - a->ptr = NULL; + + if (a->shutdown && a->init && a->ptr != NULL) { + BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr; + BUF_MEM *b = bb->buf; + + if (a->flags & BIO_FLAGS_MEM_RDONLY) + b->data = NULL; + BUF_MEM_free(b); + if (free_all) { + OPENSSL_free(bb->readp); + OPENSSL_free(bb); } + a->ptr = NULL; } return 1; } |