summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2022-01-06 11:46:06 +0000
committerKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2022-01-06 11:46:06 +0000
commit673a59310eb7ba71780ce39fd504a7891908783f (patch)
tree842307f8d1e89e0ff0ed276ab1527dab2214f53a
parent1a2ee852e2a4da34022081c3117be98198fa24aa (diff)
Free memory if error occurred
-rw-r--r--usr.bin/openssl/cms.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/openssl/cms.c b/usr.bin/openssl/cms.c
index 67ce15ab566..9e955cf1ac9 100644
--- a/usr.bin/openssl/cms.c
+++ b/usr.bin/openssl/cms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms.c,v 1.25 2022/01/06 11:37:29 inoguchi Exp $ */
+/* $OpenBSD: cms.c,v 1.26 2022/01/06 11:46:05 inoguchi Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -1927,7 +1927,7 @@ static CMS_ReceiptRequest *
make_receipt_request(STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
STACK_OF(OPENSSL_STRING) *rr_from)
{
- STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
+ STACK_OF(GENERAL_NAMES) *rct_to = NULL, *rct_from = NULL;
CMS_ReceiptRequest *rr;
rct_to = make_names_stack(rr_to);
@@ -1948,6 +1948,8 @@ make_receipt_request(STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
return rr;
err:
+ sk_GENERAL_NAMES_pop_free(rct_to, GENERAL_NAMES_free);
+ sk_GENERAL_NAMES_pop_free(rct_from, GENERAL_NAMES_free);
return NULL;
}