diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2022-07-24 18:41:09 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2022-07-24 18:41:09 +0000 |
commit | a071543ed6607be610fb6332659ea3d81b11986c (patch) | |
tree | 96deb6a5bf9a00c9ff99fc38df6cdd1c8f1c593d /lib/libcrypto/pkcs12 | |
parent | 5aaaee86bbb9c27a95f766be3e7f417cf2ba684b (diff) |
Plug a leak in PKCS12_setup_mac()
based on OpenSSL 1b8f1937 by Dmitry Belyavskiy
ok jsing
Diffstat (limited to 'lib/libcrypto/pkcs12')
-rw-r--r-- | lib/libcrypto/pkcs12/p12_mutl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libcrypto/pkcs12/p12_mutl.c b/lib/libcrypto/pkcs12/p12_mutl.c index f3a6ea3ba3a..aaba1e74de9 100644 --- a/lib/libcrypto/pkcs12/p12_mutl.c +++ b/lib/libcrypto/pkcs12/p12_mutl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: p12_mutl.c,v 1.27 2021/12/12 21:30:14 tb Exp $ */ +/* $OpenBSD: p12_mutl.c,v 1.28 2022/07/24 18:41:08 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 1999. */ @@ -174,7 +174,8 @@ int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, const EVP_MD *md_type) { - if (!(p12->mac = PKCS12_MAC_DATA_new())) + PKCS12_MAC_DATA_free(p12->mac); + if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL) return PKCS12_ERROR; if (iter > 1) { if (!(p12->mac->iter = ASN1_INTEGER_new())) { |