Merge pull request #9922 from Frauschi/f-450

Fix memory leak in error case within RsaMGF1
This commit is contained in:
Daniel Pouzzner
2026-03-09 23:39:30 -05:00
committed by GitHub
+4
View File
@@ -985,6 +985,10 @@ static int RsaMGF1(enum wc_HashType hType, byte* seed, word32 seedSz,
#endif
if (ret != 0) {
/* check for if dynamic memory was needed, then free */
#ifdef WOLFSSL_SMALL_STACK_CACHE
wc_HashFree(hash, hType);
XFREE(hash, heap, DYNAMIC_TYPE_DIGEST);
#endif
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
if (tmpF) {
XFREE(tmp, heap, DYNAMIC_TYPE_RSA_BUFFER);