summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2022-01-16 07:11:50 +0000
committerKinichiro Inoguchi <inoguchi@cvs.openbsd.org>2022-01-16 07:11:50 +0000
commit5d7da574571bf55bb80528de3ba3b0236504835d (patch)
tree27de1fc8b6f60df1db4851cb76426b6c64b65c16
parent4b756a35865ae5d275cb9cdaf9dc8140ad407994 (diff)
Avoid memory leak in error path with openssl(1) cms
CID 345314 345320 ok tb@
-rw-r--r--usr.bin/openssl/cms.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.bin/openssl/cms.c b/usr.bin/openssl/cms.c
index 8d066e5a55d..5b876941fb9 100644
--- a/usr.bin/openssl/cms.c
+++ b/usr.bin/openssl/cms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cms.c,v 1.28 2022/01/08 06:05:39 inoguchi Exp $ */
+/* $OpenBSD: cms.c,v 1.29 2022/01/16 07:11:49 inoguchi Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
@@ -1395,6 +1395,7 @@ cms_main(int argc, char **argv)
BIO_printf(bio_err,
"Error writing certs to %s\n",
cms_config.certsoutfile);
+ sk_X509_pop_free(allcerts, X509_free);
ret = 5;
goto end;
}
@@ -1695,6 +1696,7 @@ cms_main(int argc, char **argv)
BIO_printf(bio_err,
"Error writing signers to %s\n",
cms_config.signerfile);
+ sk_X509_free(signers);
ret = 5;
goto end;
}