diff options
author | J Mohan Rao Arisankala <mohan@barracuda.com> | 2016-05-05 23:43:32 +0530 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-09 09:06:06 +0100 |
commit | cb1d435cac2a9a7bd6019f9f23648c8075251109 (patch) | |
tree | 37af32e7b67b0871d5542ac223bddfb66058f936 /crypto/evp/bio_b64.c | |
parent | 5cf14ce074dfd1780ae4c68b2e7f083bfaf47530 (diff) |
few missing allocation failure checks and releases on error paths
- Missing checks for allocation failure.
- releasing memory in few missing error paths
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'crypto/evp/bio_b64.c')
-rw-r--r-- | crypto/evp/bio_b64.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/evp/bio_b64.c b/crypto/evp/bio_b64.c index cdb50b4584..6a95cf6dd6 100644 --- a/crypto/evp/bio_b64.c +++ b/crypto/evp/bio_b64.c @@ -118,10 +118,15 @@ static int b64_new(BIO *bi) ctx = OPENSSL_zalloc(sizeof(*ctx)); if (ctx == NULL) - return (0); + return 0; ctx->cont = 1; ctx->start = 1; + if (ctx->base64 == NULL) { + OPENSSL_free(ctx); + return 0; + } + ctx->base64 = EVP_ENCODE_CTX_new(); BIO_set_data(bi, ctx); BIO_set_init(bi, 1); |