summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-07-24 18:41:08 +0000
committertb <>2022-07-24 18:41:08 +0000
commitf7c32e80c91813c76c71a6198fafdeeff899f215 (patch)
tree2b77ebe29ddd2da14e39aeae75edfd6aed1b8cb1 /src
parentf6f476b8789fc6936707dff8d95b1f50021873be (diff)
downloadopenbsd-f7c32e80c91813c76c71a6198fafdeeff899f215.tar.gz
openbsd-f7c32e80c91813c76c71a6198fafdeeff899f215.tar.bz2
openbsd-f7c32e80c91813c76c71a6198fafdeeff899f215.zip
Plug a leak in PKCS12_setup_mac()
based on OpenSSL 1b8f1937 by Dmitry Belyavskiy ok jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/pkcs12/p12_mutl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/pkcs12/p12_mutl.c b/src/lib/libcrypto/pkcs12/p12_mutl.c
index f3a6ea3ba3..aaba1e74de 100644
--- a/src/lib/libcrypto/pkcs12/p12_mutl.c
+++ b/src/lib/libcrypto/pkcs12/p12_mutl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p12_mutl.c,v 1.27 2021/12/12 21:30:14 tb Exp $ */ 1/* $OpenBSD: p12_mutl.c,v 1.28 2022/07/24 18:41:08 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -174,7 +174,8 @@ int
174PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen, 174PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt, int saltlen,
175 const EVP_MD *md_type) 175 const EVP_MD *md_type)
176{ 176{
177 if (!(p12->mac = PKCS12_MAC_DATA_new())) 177 PKCS12_MAC_DATA_free(p12->mac);
178 if ((p12->mac = PKCS12_MAC_DATA_new()) == NULL)
178 return PKCS12_ERROR; 179 return PKCS12_ERROR;
179 if (iter > 1) { 180 if (iter > 1) {
180 if (!(p12->mac->iter = ASN1_INTEGER_new())) { 181 if (!(p12->mac->iter = ASN1_INTEGER_new())) {