mirror of
https://github.com/openssl/openssl.git
synced 2025-03-31 20:10:45 +08:00
Fix mem leaks on PKCS#12 read error in PKCS12_key_gen_{asc,utf8}
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/12639)
This commit is contained in:
parent
5f2b7db09b
commit
ed4faae00c
@ -33,10 +33,8 @@ int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
|
||||
}
|
||||
ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen,
|
||||
id, iter, n, out, md_type);
|
||||
if (ret <= 0)
|
||||
return 0;
|
||||
OPENSSL_clear_free(unipass, uniplen);
|
||||
return ret;
|
||||
return ret > 0;
|
||||
}
|
||||
|
||||
int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,
|
||||
@ -56,10 +54,8 @@ int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,
|
||||
}
|
||||
ret = PKCS12_key_gen_uni(unipass, uniplen, salt, saltlen,
|
||||
id, iter, n, out, md_type);
|
||||
if (ret <= 0)
|
||||
return 0;
|
||||
OPENSSL_clear_free(unipass, uniplen);
|
||||
return ret;
|
||||
return ret > 0;
|
||||
}
|
||||
|
||||
int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
|
||||
|
Loading…
x
Reference in New Issue
Block a user