mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 23:31:53 -05:00
[Crypto] Delete mbedtls ctx in deconstructor.
Would cause memory leak when the context was `start`ed but not `finish`ed.
This commit is contained in:
@@ -249,6 +249,13 @@ PackedByteArray HMACContextMbedTLS::finish() {
|
||||
return out;
|
||||
}
|
||||
|
||||
HMACContextMbedTLS::~HMACContextMbedTLS() {
|
||||
if (ctx != nullptr) {
|
||||
mbedtls_md_free((mbedtls_md_context_t *)ctx);
|
||||
memfree((mbedtls_md_context_t *)ctx);
|
||||
}
|
||||
}
|
||||
|
||||
Crypto *CryptoMbedTLS::create() {
|
||||
return memnew(CryptoMbedTLS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user