diff options
Diffstat (limited to 'src/crypto/bio/buffer.c')
-rw-r--r-- | src/crypto/bio/buffer.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/crypto/bio/buffer.c b/src/crypto/bio/buffer.c index 5e423a1..3fc0685 100644 --- a/src/crypto/bio/buffer.c +++ b/src/crypto/bio/buffer.c @@ -122,17 +122,13 @@ err1: static int buffer_free(BIO *bio) { BIO_F_BUFFER_CTX *ctx; - if (bio == NULL) { + if (bio == NULL || bio->ptr == NULL) { return 0; } ctx = (BIO_F_BUFFER_CTX *)bio->ptr; - if (ctx->ibuf != NULL) { - OPENSSL_free(ctx->ibuf); - } - if (ctx->obuf != NULL) { - OPENSSL_free(ctx->obuf); - } + OPENSSL_free(ctx->ibuf); + OPENSSL_free(ctx->obuf); OPENSSL_free(bio->ptr); bio->ptr = NULL; @@ -315,8 +311,9 @@ static long buffer_ctrl(BIO *b, int cmd, long num, void *ptr) { case BIO_CTRL_WPENDING: ret = (long)ctx->obuf_len; if (ret == 0) { - if (b->next_bio == NULL) + if (b->next_bio == NULL) { return 0; + } ret = BIO_ctrl(b->next_bio, cmd, num, ptr); } break; |