diff --git a/tests/api/test_ssl_cert.c b/tests/api/test_ssl_cert.c index 22cdc54803..b37fb6fb63 100644 --- a/tests/api/test_ssl_cert.c +++ b/tests/api/test_ssl_cert.c @@ -963,7 +963,9 @@ int test_wolfSSL_load_client_CA_file(void) WOLF_STACK_OF(WOLFSSL_X509_NAME)* names = NULL; /* A file that cannot be opened reports no names. */ - ExpectNull(wolfSSL_load_client_CA_file("does/not/exist.pem")); + ExpectNull(names = wolfSSL_load_client_CA_file("does/not/exist.pem")); + wolfSSL_sk_X509_NAME_pop_free(names, NULL); + names = NULL; /* Every certificate in the file contributes its subject name. */ ExpectNotNull(names = wolfSSL_load_client_CA_file(caCertFile));