Fix memory leak in error case within RsaMGF1

This commit is contained in:
Tobias Frauenschläger
2026-03-09 11:17:31 +01:00
parent b3f08f33b8
commit 9c2bb3d10d
+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);