@@ -700,6 +700,34 @@ static int test_fileAccess(void)
700700#endif
701701 return EXPECT_RESULT();
702702}
703+ static int test_wc_FreeCertList(void)
704+ {
705+ EXPECT_DECLS;
706+ #if defined(HAVE_PKCS12) && !defined(NO_ASN) && \
707+ !defined(NO_PWDBASED) && !defined(NO_HMAC) && !defined(NO_CERTS) && \
708+ defined(USE_CERT_BUFFERS_2048)
709+ WC_DerCertList* list = NULL;
710+ void* heap = NULL;
711+ /* Test freeing a list with a single node */
712+ list = (WC_DerCertList*)XMALLOC(sizeof(WC_DerCertList),
713+ heap, DYNAMIC_TYPE_PKCS);
714+ ExpectNotNull(list);
715+ if (list != NULL) {
716+ list->buffer = (byte*)XMALLOC(10, heap, DYNAMIC_TYPE_PKCS);
717+ ExpectNotNull(list->buffer);
718+ if (list->buffer != NULL) {
719+ list->bufferSz = 10;
720+ list->next = NULL;
721+ wc_FreeCertList(list, heap);
722+ }
723+ else {
724+ XFREE(list, heap, DYNAMIC_TYPE_PKCS);
725+ list = NULL;
726+ }
727+ }
728+ #endif
729+ return EXPECT_RESULT();
730+ }
703731
704732/*----------------------------------------------------------------------------*
705733 | Method Allocators
@@ -67029,6 +67057,7 @@ TEST_CASE testCases[] = {
6702967057 TEST_DECL(test_wc_LoadStaticMemory_ex),
6703067058 TEST_DECL(test_wc_LoadStaticMemory_CTX),
6703167059
67060+ TEST_DECL(test_wc_FreeCertList),
6703267061 /* Locking with Compat Mutex */
6703367062 TEST_DECL(test_wc_SetMutexCb),
6703467063 TEST_DECL(test_wc_LockMutex_ex),
0 commit comments