forked from wolfSSL/wolfssl
Fix possible AES leaks detected with sanitizer and clang-tidy.
This commit is contained in:
@ -14060,11 +14060,16 @@ static WARN_UNUSED_RESULT int AesSivCipher(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aes->isAllocated = 0;
|
|
||||||
wc_AesFree(aes);
|
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(aes, NULL, DYNAMIC_TYPE_AES);
|
if (aes != NULL)
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
aes->isAllocated = 0;
|
||||||
|
wc_AesFree(aes);
|
||||||
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
|
XFREE(aes, NULL, DYNAMIC_TYPE_AES);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -15913,8 +15913,8 @@ static wc_test_ret_t aesccm_128_test(void)
|
|||||||
XMEMSET(p2, 0, sizeof(p2));
|
XMEMSET(p2, 0, sizeof(p2));
|
||||||
XMEMSET(iv2, 0, sizeof(iv2));
|
XMEMSET(iv2, 0, sizeof(iv2));
|
||||||
|
|
||||||
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
|
||||||
wc_AesFree(enc);
|
wc_AesFree(enc);
|
||||||
|
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
||||||
enc = wc_AesNew(HEAP_HINT, devId);
|
enc = wc_AesNew(HEAP_HINT, devId);
|
||||||
if (enc == NULL)
|
if (enc == NULL)
|
||||||
ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), out);
|
ERROR_OUT(WC_TEST_RET_ENC_EC(MEMORY_E), out);
|
||||||
|
Reference in New Issue
Block a user