@@ -72,7 +72,7 @@ WOLFSSL_X509_STORE_CTX* wolfSSL_X509_STORE_CTX_new_ex(void* heap)
7272 if (ctx != NULL &&
7373 wolfSSL_X509_STORE_CTX_init (ctx , NULL , NULL , NULL ) !=
7474 WOLFSSL_SUCCESS ) {
75- XFREE (ctx , heap , DYNAMIC_TYPE_X509_CTX );
75+ wolfSSL_X509_STORE_CTX_free (ctx );
7676 ctx = NULL ;
7777 }
7878#endif
@@ -105,7 +105,6 @@ void wolfSSL_X509_STORE_CTX_free(WOLFSSL_X509_STORE_CTX* ctx)
105105
106106 if (ctx -> current_issuer != NULL ) {
107107 wolfSSL_X509_free (ctx -> current_issuer );
108- ctx -> current_issuer = NULL ;
109108 }
110109#endif
111110
@@ -395,7 +394,7 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
395394 /* We found our issuer in the non-trusted cert list, add it
396395 * to the CM and verify the current cert against it */
397396 ret = X509StoreAddCa (ctx -> store , issuer ,
398- WOLFSSL_INTER_CA );
397+ WOLFSSL_TEMP_CA );
399398 if (ret != WOLFSSL_SUCCESS ) {
400399 goto exit ;
401400 }
@@ -920,17 +919,15 @@ int wolfSSL_X509_STORE_CTX_get1_issuer(WOLFSSL_X509 **issuer,
920919
921920 ret = X509StoreGetIssuerEx (issuer , ctx -> store -> certs , x );
922921 if ((ret == WOLFSSL_SUCCESS ) && (* issuer != NULL )) {
923- * issuer = wolfSSL_X509_dup (* issuer );
924- return (* issuer != NULL ) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE ;
922+ return wolfSSL_X509_up_ref (* issuer );
925923 }
926924
927925#ifdef WOLFSSL_SIGNER_DER_CERT
928926 ret = x509GetIssuerFromCM (issuer , ctx -> store -> cm , x );
929927#else
930928 ret = X509StoreGetIssuerEx (issuer , ctx -> store -> trusted , x );
931929 if ((ret == WOLFSSL_SUCCESS ) && (* issuer != NULL )) {
932- * issuer = wolfSSL_X509_dup (* issuer );
933- return (* issuer != NULL ) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE ;
930+ return wolfSSL_X509_up_ref (* issuer );
934931 }
935932#endif
936933
@@ -1065,7 +1062,7 @@ static void X509StoreFreeObjList(WOLFSSL_X509_STORE* store,
10651062 obj = wolfSSL_sk_X509_OBJECT_value (objs , i );
10661063 if (obj != NULL ) {
10671064 obj -> type = 0 ;
1068- obj -> data .x509 = NULL ;
1065+ obj -> data .ptr = NULL ;
10691066 }
10701067 cnt -- ;
10711068 i -- ;
0 commit comments