mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
woflcrypt/src/rsa.c: check memory allocation return value
This commit is contained in:
@@ -2882,7 +2882,7 @@ int wc_RsaFunction(const byte* in, word32 inLen, byte* out,
|
|||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mp_init(c) != MP_OKAY)
|
if (ret == 0 && mp_init(c) != MP_OKAY)
|
||||||
ret = MP_INIT_E;
|
ret = MP_INIT_E;
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
if (mp_read_unsigned_bin(c, in, inLen) != 0)
|
if (mp_read_unsigned_bin(c, in, inLen) != 0)
|
||||||
@@ -2906,7 +2906,8 @@ int wc_RsaFunction(const byte* in, word32 inLen, byte* out,
|
|||||||
mp_clear(c);
|
mp_clear(c);
|
||||||
|
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(c, key->heap, DYNAMIC_TYPE_RSA);
|
if (c != NULL)
|
||||||
|
XFREE(c, key->heap, DYNAMIC_TYPE_RSA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
Reference in New Issue
Block a user