Skip to content

Commit fa9e122

Browse files
authored
Merge pull request #8952 from SparkiDev/mem_fail_fixes_3
Unit Test: fix test case for memory allocation failure testing
2 parents ff80d62 + af05fa8 commit fa9e122

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

tests/api/test_ocsp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ int test_ocsp_basic_verify(void)
243243
ExpectIntEQ(wolfSSL_OCSP_basic_verify(response, NULL, NULL, OCSP_NOVERIFY),
244244
WOLFSSL_FAILURE);
245245
wolfSSL_OCSP_RESPONSE_free(response);
246+
response = NULL;
246247

247248
/* populate a store with root-ca-cert */
248249
ExpectIntEQ(test_ocsp_create_x509store(&store, root_ca_cert_pem,
@@ -261,6 +262,7 @@ int test_ocsp_basic_verify(void)
261262
ExpectIntEQ(wolfSSL_OCSP_basic_verify(response, certs, store, 0),
262263
WOLFSSL_SUCCESS);
263264
wolfSSL_OCSP_RESPONSE_free(response);
265+
response = NULL;
264266

265267
/* cert embedded, verified using store */
266268
ptr = (const unsigned char*)resp;
@@ -290,6 +292,7 @@ int test_ocsp_basic_verify(void)
290292
ExpectIntNE(wolfSSL_OCSP_basic_verify(response, NULL, store, OCSP_NOINTERN),
291293
WOLFSSL_SUCCESS);
292294
wolfSSL_OCSP_RESPONSE_free(response);
295+
response = NULL;
293296

294297
/* cert not embedded, not certs */
295298
ptr = (const unsigned char*)resp_nocert;
@@ -298,9 +301,12 @@ int test_ocsp_basic_verify(void)
298301
ExpectIntNE(wolfSSL_OCSP_basic_verify(response, NULL, store, 0),
299302
WOLFSSL_SUCCESS);
300303
wolfSSL_OCSP_RESPONSE_free(response);
304+
response = NULL;
301305

302306
wolfSSL_sk_X509_pop_free(certs, wolfSSL_X509_free);
307+
certs = NULL;
303308
wolfSSL_X509_STORE_free(store);
309+
store = NULL;
304310

305311
ExpectIntEQ(test_ocsp_create_x509store(&store, root_ca_cert_pem,
306312
sizeof(root_ca_cert_pem)),
@@ -316,6 +322,7 @@ int test_ocsp_basic_verify(void)
316322
ExpectIntEQ(wolfSSL_OCSP_basic_verify(response, certs, store, 0),
317323
WOLFSSL_SUCCESS);
318324
wolfSSL_OCSP_RESPONSE_free(response);
325+
response = NULL;
319326

320327
/* cert in certs, cert verified on store, not authorized to verify all
321328
* responses */

0 commit comments

Comments
 (0)