Don't leak memory on error in PKCS12_key_gen_uni
authorMatt Caswell <matt@openssl.org>
Wed, 27 Apr 2016 13:06:40 +0000 (14:06 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 28 Apr 2016 12:13:09 +0000 (13:13 +0100)
The PKCS12_key_gen_uni() had one error path which did not free memory
correctly.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/pkcs12/p12_key.c

index 6a9a325..1a1ea70 100644 (file)
@@ -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);