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 | |
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')
-rw-r--r-- | crypto/evp/bio_b64.c | 7 | ||||
-rw-r--r-- | crypto/evp/bio_ok.c | 4 |
2 files changed, 10 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); diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c index 0ac1a31a63..65577c0f6c 100644 --- a/crypto/evp/bio_ok.c +++ b/crypto/evp/bio_ok.c @@ -183,6 +183,10 @@ static int ok_new(BIO *bi) ctx->cont = 1; ctx->sigio = 1; ctx->md = EVP_MD_CTX_new(); + if (ctx->md == NULL) { + OPENSSL_free(ctx); + return 0; + } BIO_set_init(bi, 0); BIO_set_data(bi, ctx); |