handle failing RNG init when creating PKEY

This commit is contained in:
JacobBarthelmeh
2023-03-20 07:17:25 -07:00
parent c3b51af6cd
commit 72e53ca1a4

View File

@ -9496,7 +9496,8 @@ WOLFSSL_EVP_PKEY* wolfSSL_EVP_PKEY_new_ex(void* heap)
ret = wc_InitRng(&pkey->rng); ret = wc_InitRng(&pkey->rng);
#endif #endif
if (ret != 0){ if (ret != 0){
wolfSSL_EVP_PKEY_free(pkey); /* Free directly since mutex for ref count not set yet */
XFREE(pkey, heap, DYNAMIC_TYPE_PUBLIC_KEY);
WOLFSSL_MSG("Issue initializing RNG"); WOLFSSL_MSG("Issue initializing RNG");
return NULL; return NULL;
} }