summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2018-11-10 02:23:28 +0000
committerjsing <jsing@openbsd.org>2018-11-10 02:23:28 +0000
commitbc2cda7a78beb4cb332aec801a9d77865584471b (patch)
treea65cb0693cdbcdb17b9906686fbe5b144bf0c4d5
parentfix a leak reported by Ben L (bobsayshilol () live ! co ! uk) (diff)
downloadwireguard-openbsd-bc2cda7a78beb4cb332aec801a9d77865584471b.tar.xz
wireguard-openbsd-bc2cda7a78beb4cb332aec801a9d77865584471b.zip
Clean up and free objects at the completion of the regress test.
From Ben L <bobsayshilol at live dot co dot uk>.
-rw-r--r--regress/lib/libcrypto/pkcs7/pkcs7test.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/regress/lib/libcrypto/pkcs7/pkcs7test.c b/regress/lib/libcrypto/pkcs7/pkcs7test.c
index 55483073752..5a72586ca86 100644
--- a/regress/lib/libcrypto/pkcs7/pkcs7test.c
+++ b/regress/lib/libcrypto/pkcs7/pkcs7test.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pkcs7test.c,v 1.3 2014/11/26 05:48:00 bcook Exp $ */
+/* $OpenBSD: pkcs7test.c,v 1.4 2018/11/10 02:23:28 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -203,10 +203,12 @@ main(int argc, char **argv)
fatal("PEM_read_bio_PKCS7");
if (PKCS7_decrypt(p7, pkey, cert, bio_out, 0) != 1)
fatal("PKCS7_decrypt");
+ PKCS7_free(p7);
len = BIO_get_mem_data(bio_out, &out);
message_compare(out, len);
+ BIO_free(bio_in);
BIO_free(bio_out);
/*
@@ -235,6 +237,7 @@ main(int argc, char **argv)
fatal("PEM_read_bio_PKCS7");
if (PKCS7_verify(p7, certs, store, NULL, bio_out, 0) != 1)
fatal("PKCS7_verify");
+ PKCS7_free(p7);
len = BIO_get_mem_data(bio_out, &out);
message_compare(out, len);
@@ -277,6 +280,7 @@ main(int argc, char **argv)
fatal("PEM_read_bio_PKCS7");
if (PKCS7_verify(p7, certs, store, bio_content, bio_out, flags) != 1)
fatal("PKCS7_verify");
+ PKCS7_free(p7);
len = BIO_get_mem_data(bio_out, &out);
message_compare(out, len);
@@ -284,6 +288,14 @@ main(int argc, char **argv)
BIO_free(bio_in);
BIO_free(bio_out);
BIO_free(bio_content);
+ BIO_free(bio_cert);
+ BIO_free(bio_pkey);
+
+ EVP_PKEY_free(pkey);
+
+ X509_free(cert);
+ X509_STORE_free(store);
+ sk_X509_free(certs);
return 0;
}