mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-26 23:42:22 +01:00
Fix memory leak in unit test, fix for loop syntax.
This commit is contained in:
@@ -472,6 +472,7 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
|
||||
int added = 0;
|
||||
int i = 0;
|
||||
int numInterAdd = 0;
|
||||
int numFailedCerts = 0;
|
||||
int depth = 0;
|
||||
int origDepth = 0;
|
||||
WOLFSSL_X509 *issuer = NULL;
|
||||
@@ -627,8 +628,8 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
|
||||
exit:
|
||||
/* Copy back failed certs if verification failed. */
|
||||
if (ret != WOLFSSL_SUCCESS) {
|
||||
for (int cnt = 0, total = wolfSSL_sk_X509_num(failedCerts);
|
||||
cnt < total; cnt++)
|
||||
numFailedCerts = wolfSSL_sk_X509_num(failedCerts);
|
||||
for (i = 0; i < numFailedCerts; i++)
|
||||
{
|
||||
wolfSSL_sk_X509_push(certs, wolfSSL_sk_X509_pop(failedCerts));
|
||||
}
|
||||
|
||||
@@ -20390,9 +20390,9 @@ static int test_wolfSSL_X509_STORE_CTX_ex12(void)
|
||||
ExpectNotNull(ctx = X509_STORE_CTX_new());
|
||||
ExpectIntEQ(X509_STORE_CTX_init(ctx, store, badAkiX509, NULL), 1);
|
||||
ExpectIntEQ(X509_verify_cert(ctx), 0);
|
||||
X509_STORE_CTX_cleanup(ctx);
|
||||
|
||||
ExpectIntEQ(X509_STORE_add_cert(store, badAkiX509), 1);
|
||||
ExpectNotNull(ctx = X509_STORE_CTX_new());
|
||||
ExpectNotNull(ca1X509 = test_wolfSSL_X509_STORE_CTX_ex_helper(intCA1ECCFile));
|
||||
ExpectIntEQ(X509_STORE_CTX_init(ctx, store, ca1X509, NULL), 1);
|
||||
ExpectIntEQ(X509_verify_cert(ctx), 1);
|
||||
|
||||
Reference in New Issue
Block a user