mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-10 23:50:51 +02:00
tests: fix AUTHORITY_INFO_ACCESS leak under OPENSSL_EXTRA-only builds
This branch widened test_wolfSSL_X509V3_EXT's guard from OPENSSL_ALL to (OPENSSL_EXTRA || OPENSSL_ALL). The Authority Info Access sub-test frees its aia stack with wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(aia, NULL), relying on the stack's type-based element free - but wolfssl_sk_get_free_func() only wires up wolfSSL_ACCESS_DESCRIPTION_free for STACK_TYPE_ACCESS_DESCRIPTION under OPENSSL_ALL. In an OPENSSL_EXTRA-only build (now reachable) the NULL callback frees the stack nodes but leaks each ACCESS_DESCRIPTION (struct + method OBJ + location GENERAL_NAME + URI string): 370 bytes, caught by ASAN/valgrind. Pass wolfSSL_ACCESS_DESCRIPTION_free explicitly (available under OPENSSL_EXTRA); correct under OPENSSL_ALL too. Verified leak-free under ASAN with the failing config (--enable-opensslextra --enable-crl ... --disable-fastmath).
This commit is contained in:
@@ -1645,7 +1645,11 @@ int test_wolfSSL_X509V3_EXT(void)
|
||||
ExpectNull(wolfSSL_sk_ACCESS_DESCRIPTION_value(NULL, 0));
|
||||
ExpectNull(wolfSSL_sk_ACCESS_DESCRIPTION_value(aia, 1));
|
||||
ExpectNotNull(wolfSSL_sk_ACCESS_DESCRIPTION_value(aia, 0));
|
||||
wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(aia, NULL);
|
||||
/* Pass the element free explicitly: the stack's default (type-based) element
|
||||
* free for ACCESS_DESCRIPTION is only wired up under OPENSSL_ALL, so with a
|
||||
* NULL callback an OPENSSL_EXTRA-only build (this block now compiles there)
|
||||
* frees the stack nodes but leaks each ACCESS_DESCRIPTION. */
|
||||
wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(aia, wolfSSL_ACCESS_DESCRIPTION_free);
|
||||
aia = NULL;
|
||||
|
||||
#ifndef NO_WOLFSSL_STUB
|
||||
|
||||
Reference in New Issue
Block a user