free signer if malloc cases fail

This commit is contained in:
JacobBarthelmeh
2022-11-30 10:02:33 -08:00
parent 973de0e954
commit 01833a369e

View File

@ -5383,7 +5383,6 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
else { else {
WOLFSSL_MSG("\tCA Mutex Lock failed"); WOLFSSL_MSG("\tCA Mutex Lock failed");
ret = BAD_MUTEX_E; ret = BAD_MUTEX_E;
FreeSigner(signer, cm->heap);
} }
} }
#if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_SCEPROTECT) #if defined(WOLFSSL_RENESAS_TSIP_TLS) || defined(WOLFSSL_RENESAS_SCEPROTECT)
@ -5411,6 +5410,8 @@ int AddCA(WOLFSSL_CERT_MANAGER* cm, DerBuffer** pDer, int type, int verify)
WOLFSSL_MSG("\tFreeing Parsed CA"); WOLFSSL_MSG("\tFreeing Parsed CA");
FreeDecodedCert(cert); FreeDecodedCert(cert);
if (ret != 0 && signer != NULL)
FreeSigner(signer, cm->heap);
#ifdef WOLFSSL_SMALL_STACK #ifdef WOLFSSL_SMALL_STACK
XFREE(cert, NULL, DYNAMIC_TYPE_DCERT); XFREE(cert, NULL, DYNAMIC_TYPE_DCERT);
#endif #endif