From a75d520727378b0d3a1c6e15dac5438a0c9f9d68 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Thu, 8 Aug 2024 11:40:57 -0500 Subject: [PATCH] src/pk.c: fix a null deref (nullPointerRedundantCheck) in wolfSSL_RSA_GenAdd() added in d350ba6c41. --- src/pk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pk.c b/src/pk.c index 8b8dd97737..34e2727844 100644 --- a/src/pk.c +++ b/src/pk.c @@ -4691,7 +4691,9 @@ int wolfSSL_RSA_GenAdd(WOLFSSL_RSA* rsa) mp_clear(t); #ifdef WOLFSSL_SMALL_STACK - XFREE(tmp, rsa->heap, DYNAMIC_TYPE_TMP_BUFFER); + if (rsa != NULL) { + XFREE(tmp, rsa->heap, DYNAMIC_TYPE_TMP_BUFFER); + } #endif return ret;