From 26cc534dd2b9b206a2c2131bdcb6926173743b14 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 5 Nov 2021 22:04:50 -0500 Subject: [PATCH] wolfcrypt/test/test.c: fix memory leaks in pkcs7signed_run_[SingleShot]Vectors() added in smallstack refactor. --- wolfcrypt/test/test.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 2687640de..36bf512c8 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -33423,6 +33423,8 @@ static int pkcs7signed_run_vectors( ERROR_OUT(-12512, out); for (i = 0; i < testSz; i++) { + if (pkcs7) + wc_PKCS7_Free(pkcs7); pkcs7 = wc_PKCS7_New(HEAP_HINT, devId); if (pkcs7 == NULL) ERROR_OUT(-12513, out); @@ -33922,6 +33924,8 @@ static int pkcs7signed_run_SingleShotVectors( ERROR_OUT(-12542, out); for (i = 0; i < testSz; i++) { + if (pkcs7) + wc_PKCS7_Free(pkcs7); pkcs7 = wc_PKCS7_New(HEAP_HINT, devId); if (pkcs7 == NULL) ERROR_OUT(-12543, out);