diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2016-11-05 13:02:35 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2016-11-05 13:02:35 +0000 |
commit | 337c749e29521dd0d48b9d5809a63f1ae7aa5a00 (patch) | |
tree | 07ed7826516c77b19c8cac506f5dc8ba036c3820 /lib/libcrypto/pkcs12 | |
parent | e0416d46c02adeb5f4d214120fa1c58c066d910d (diff) |
Do not leak the ressources possibly allocated by EVP_MD_CTX_init() in the
trivial error path of PKCS12_key_gen_uni().
ok beck@ jsing@
Diffstat (limited to 'lib/libcrypto/pkcs12')
-rw-r--r-- | lib/libcrypto/pkcs12/p12_key.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libcrypto/pkcs12/p12_key.c b/lib/libcrypto/pkcs12/p12_key.c index 38f8a8194c7..891f764c232 100644 --- a/lib/libcrypto/pkcs12/p12_key.c +++ b/lib/libcrypto/pkcs12/p12_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p12_key.c,v 1.23 2015/09/10 15:56:25 jsing Exp $ */ +/* $OpenBSD: p12_key.c,v 1.24 2016/11/05 13:02:34 miod Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -107,11 +107,12 @@ PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, BIGNUM *Ij, *Bpl1; /* These hold Ij and B + 1 */ EVP_MD_CTX ctx; - EVP_MD_CTX_init(&ctx); v = EVP_MD_block_size(md_type); u = EVP_MD_size(md_type); if (u < 0) return 0; + + EVP_MD_CTX_init(&ctx); D = malloc(v); Ai = malloc(u); B = malloc(v + 1); |