From: Matt Caswell Date: Wed, 27 Apr 2016 13:06:40 +0000 (+0100) Subject: Don't leak memory on error in PKCS12_key_gen_uni X-Git-Tag: OpenSSL_1_1_0-pre6~1027 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=460c5e1d2f7388216f12d345d13202381b30e2a3;hp=8e588e2812f82419fb177e42480b4edffc676070 Don't leak memory on error in PKCS12_key_gen_uni The PKCS12_key_gen_uni() had one error path which did not free memory correctly. Reviewed-by: Richard Levitte --- diff --git a/crypto/pkcs12/p12_key.c b/crypto/pkcs12/p12_key.c index 6a9a3254b1..1a1ea7059c 100644 --- a/crypto/pkcs12/p12_key.c +++ b/crypto/pkcs12/p12_key.c @@ -129,7 +129,7 @@ int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, v = EVP_MD_block_size(md_type); u = EVP_MD_size(md_type); if (u < 0) - return 0; + goto err; D = OPENSSL_malloc(v); Ai = OPENSSL_malloc(u); B = OPENSSL_malloc(v + 1);